Skip to content
Browse files

fix: add migration for newsletter field

  • Loading branch information...
themightychris committed Jun 19, 2019
1 parent 93a6fc4 commit c81a39fb0dcd06c678f9eb2bc6fce203c9ddf922
Showing with 26 additions and 0 deletions.
  1. +26 −0 php-migrations/Laddr/20190618_add-newsletter-toggle.php
@@ -0,0 +1,26 @@
use Emergence\People\User;
// skip conditions
if (!static::tableExists(User::$tableName)) {
printf("Skipping migration because table `%s` does not exist yet\n", User::$tableName);
return static::STATUS_SKIPPED;
if (static::columnExists(User::$tableName, 'Newsletter')) {
printf("Skipping migration because column `Newsletter` in table `%s` already exists\n", User::$tableName);
return static::STATUS_SKIPPED;
// migration
printf("Adding `Newsletter` column to `%s` table\n", User::$tableName);
DB::nonQuery('ALTER TABLE `%s` ADD `Newsletter` boolean NULL default 1', User::$tableName);
printf("Adding `Newsletter` column to `%s` table\n", User::$historyTable);
DB::nonQuery('ALTER TABLE `%s` ADD `Newsletter` boolean NULL default 1', User::getHistoryTableName());
// done
return static::STATUS_EXECUTED;

0 comments on commit c81a39f

Please sign in to comment.
You can’t perform that action at this time.