Skip to content

Commit

Permalink
Always use ADD with COLUMN keyword in migrations for WP Playground
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJakes committed Aug 6, 2024
1 parent dcbdba1 commit 8c1481f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mailpoet/lib/Migrations/Db/Migration_20221028_105818.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ private function fixScheduledTasksSubscribersTimestampColumns() {
if (empty($updatedAtColumnExists)) {
$addUpdatedAtQuery = "
ALTER TABLE `$scheduledTasksSubscribersTable`
ADD `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ADD COLUMN `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
";
$wpdb->query($addUpdatedAtQuery);
}
Expand Down
2 changes: 1 addition & 1 deletion mailpoet/lib/Migrations/Db/Migration_20230111_120000.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function run(): void {

$this->connection->executeStatement("
ALTER TABLE {$segmentsTable}
ADD {$columnName} tinyint(1) NOT NULL DEFAULT 0
ADD COLUMN {$columnName} tinyint(1) NOT NULL DEFAULT 0
");

$subscriptionSetting = $this->connection->fetchOne("
Expand Down
2 changes: 1 addition & 1 deletion mailpoet/lib/Migrations/Db/Migration_20230111_130000.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function run(): void {
if (!$this->columnExists($tableName, 'method')) {
$this->connection->executeStatement("
ALTER TABLE {$tableName}
ADD method varchar(40) NOT NULL DEFAULT 'unknown'
ADD COLUMN method varchar(40) NOT NULL DEFAULT 'unknown'
");
}
}
Expand Down
4 changes: 2 additions & 2 deletions mailpoet/lib/Migrations/Db/Migration_20230221_200520.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private function addRawMessagesToLogs() {

$this->connection->executeStatement("
ALTER TABLE {$logsTable}
ADD {$columnName} longtext DEFAULT NULL
ADD COLUMN {$columnName} longtext DEFAULT NULL
");
}

Expand All @@ -35,7 +35,7 @@ private function addContextToLogs() {

$this->connection->executeStatement("
ALTER TABLE {$logsTable}
ADD {$columnName} longtext DEFAULT NULL
ADD COLUMN {$columnName} longtext DEFAULT NULL
");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function run(): void {
if (!$this->columnExists($tableName, 'wp_post_id')) {
$this->connection->executeStatement("
ALTER TABLE {$tableName}
ADD wp_post_id int NULL
ADD COLUMN wp_post_id int NULL
");
}

Expand Down

0 comments on commit 8c1481f

Please sign in to comment.