#40 adding created_at and update_at timestamps to subscribers and settings

This commit is contained in:
Laurent Szyster
2015-08-11 12:47:24 +02:00
parent 8f52e7523d
commit 4f24a8ed71
2 changed files with 32 additions and 1 deletions

View File

@@ -44,6 +44,8 @@ class Migrator {
'first_name tinytext NOT NULL,',
'last_name tinytext NOT NULL,',
'email varchar(150) NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'UNIQUE KEY email (email)'
);
@@ -55,6 +57,8 @@ class Migrator {
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'name varchar(20) NOT NULL,',
'value varchar(255) NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'UNIQUE KEY name (name)'
);
@@ -67,7 +71,7 @@ class Migrator {
$sql = array();
$sql[] = "CREATE TABLE " . $table . " (";
$sql = array_merge($sql, $attributes);
$sql[] = ")" . $this->charset . ";";
$sql[] = ") " . $this->charset . ";";
return implode("\n", $sql);
}