Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Fix Migration #1300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions anchor/migrations/213_add_updated_fields_to_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function up()
if ($this->has_table($posts)) {
if (!$this->has_table_column($posts, 'updated')) {
$sql = 'ALTER TABLE `' . $posts . '` ';
$sql .= 'ADD COLUMN `updated` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `created`';
$sql .= 'ADD COLUMN `updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `created`';
DB::ask($sql);
}
}
Expand All @@ -19,7 +19,7 @@ public function up()
if ($this->has_table($pages)) {
if (!$this->has_table_column($pages, 'updated')) {
$sql = 'ALTER TABLE `' . $pages . '` ';
$sql .= 'ADD COLUMN `updated` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
$sql .= 'ADD COLUMN `updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
DB::ask($sql);
}
}
Expand All @@ -29,7 +29,7 @@ public function up()
if ($this->has_table($users)) {
if (!$this->has_table_column($users, 'updated')) {
$sql = 'ALTER TABLE `' . $users . '` ';
$sql .= 'ADD COLUMN `updated` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
$sql .= 'ADD COLUMN `updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
DB::ask($sql);
}
}
Expand Down
2 changes: 1 addition & 1 deletion anchor/migrations/21_alter_comments_date.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public function up()
$table = Base::table('comments');

if ($this->has_table($table)) {
$sql = 'ALTER TABLE `' . $table . '` CHANGE `date` `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `status`';
$sql = 'ALTER TABLE `' . $table . '` CHANGE `date` `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `status`';
DB::ask($sql);
}
}
Expand Down
2 changes: 1 addition & 1 deletion anchor/migrations/61_alter_posts_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public function up()
$table = Base::table('posts');

if ($this->has_table_column($table, 'created')) {
$sql = 'ALTER TABLE `' . $table . '` CHANGE `created` `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `js`';
$sql = 'ALTER TABLE `' . $table . '` CHANGE `created` `created` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00" AFTER `js`';
DB::ask($sql);
}
}
Expand Down