File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Emergence \People \User ;
4+
5+ // skip conditions
6+ if (!static ::tableExists (User::$ tableName )) {
7+ printf ("Skipping migration because table `%s` does not exist yet \n" , User::$ tableName );
8+ return static ::STATUS_SKIPPED ;
9+ }
10+
11+ if (static ::columnExists (User::$ tableName , 'Newsletter ' )) {
12+ printf ("Skipping migration because column `Newsletter` in table `%s` already exists \n" , User::$ tableName );
13+ return static ::STATUS_SKIPPED ;
14+ }
15+
16+
17+ // migration
18+ printf ("Adding `Newsletter` column to `%s` table \n" , User::$ tableName );
19+ DB ::nonQuery ('ALTER TABLE `%s` ADD `Newsletter` boolean NULL default 1 ' , User::$ tableName );
20+
21+ printf ("Adding `Newsletter` column to `%s` table \n" , User::$ historyTable );
22+ DB ::nonQuery ('ALTER TABLE `%s` ADD `Newsletter` boolean NULL default 1 ' , User::getHistoryTableName ());
23+
24+
25+ // done
26+ return static ::STATUS_EXECUTED ;
You can’t perform that action at this time.
0 commit comments