diff --git a/src/Campaigns/Migrations/Tables/AddCampaignTypeColumn.php b/src/Campaigns/Migrations/Tables/AddCampaignTypeColumn.php new file mode 100644 index 0000000000..d54b13d12f --- /dev/null +++ b/src/Campaigns/Migrations/Tables/AddCampaignTypeColumn.php @@ -0,0 +1,55 @@ +give_campaigns} ADD COLUMN `campaign_type` VARCHAR(12) NOT NULL DEFAULT ''"); + } catch (DatabaseQueryException $exception) { + throw new DatabaseMigrationException("An error occurred while updating the {$wpdb->give_campaigns} table", 0, $exception); + } + } +} diff --git a/src/Campaigns/Migrations/Tables/CreateCampaignsTable.php b/src/Campaigns/Migrations/Tables/CreateCampaignsTable.php index 8bd6b2dec8..b028eed261 100644 --- a/src/Campaigns/Migrations/Tables/CreateCampaignsTable.php +++ b/src/Campaigns/Migrations/Tables/CreateCampaignsTable.php @@ -18,7 +18,7 @@ class CreateCampaignsTable extends Migration */ public static function id(): string { - return 'give-campaigns-create-give-core-campaigns-table'; + return 'give-campaigns-create-give-campaigns-table'; } /** @@ -51,7 +51,6 @@ public function run() $sql = "CREATE TABLE $table ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, form_id INT NOT NULL, - campaign_type VARCHAR(12) NOT NULL DEFAULT '', campaign_title TEXT NOT NULL, campaign_url TEXT NOT NULL, short_desc TEXT NOT NULL, diff --git a/src/Campaigns/ServiceProvider.php b/src/Campaigns/ServiceProvider.php index 8e8935f337..4d2169c748 100644 --- a/src/Campaigns/ServiceProvider.php +++ b/src/Campaigns/ServiceProvider.php @@ -2,6 +2,7 @@ namespace Give\Campaigns; +use Give\Campaigns\Migrations\Tables\AddCampaignTypeColumn; use Give\Campaigns\Migrations\Tables\CreateCampaignFormsTable; use Give\Campaigns\Migrations\Tables\CreateCampaignsTable; use Give\Framework\Migrations\MigrationsRegister; @@ -44,6 +45,7 @@ private function registerMigrations(): void give(MigrationsRegister::class)->addMigrations( [ CreateCampaignsTable::class, + AddCampaignTypeColumn::class, CreateCampaignFormsTable::class, ] );