Skip to content

Commit

Permalink
Added database prefixes supporting for one of migration stages
Browse files Browse the repository at this point in the history
  • Loading branch information
Xelson committed Mar 4, 2020
1 parent 11a2536 commit 9a364b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions migrations/2020_01_31_000000_change_timestamp_to_datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
return [
'up' => function (Builder $schema) {
$connection = $schema->getConnection();
$connection->statement("ALTER TABLE `pushedx_messages` MODIFY created_at DATETIME");
$connection->statement("ALTER TABLE `pushedx_messages` MODIFY edited_at DATETIME");
$prefix = $connection->getTablePrefix();

$connection->statement("ALTER TABLE `{$prefix}pushedx_messages` MODIFY created_at DATETIME");
$connection->statement("ALTER TABLE `{$prefix}pushedx_messages` MODIFY edited_at DATETIME");
},
'down' => function (Builder $schema) {
$connection = $schema->getConnection();
$connection->statement("ALTER TABLE `pushedx_messages` MODIFY created_at TIMESTAMP");
$connection->statement("ALTER TABLE `pushedx_messages` MODIFY edited_at TIMESTAMP");
$prefix = $connection->getTablePrefix();

$connection->statement("ALTER TABLE `{$prefix}pushedx_messages` MODIFY created_at TIMESTAMP");
$connection->statement("ALTER TABLE `{$prefix}pushedx_messages` MODIFY edited_at TIMESTAMP");
}
];

0 comments on commit 9a364b2

Please sign in to comment.