Conditions | 6 |
Paths | 32 |
Total Lines | 41 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function up() |
||
18 | { |
||
19 | // set nullable varchar type for token column |
||
20 | $this->getSchema()->table('users', function($table){ |
||
21 | $table->string('approve_token', 128)->nullable()->default(null)->change(); |
||
22 | }); |
||
23 | // set approve_token = null where it like '0' str or '' |
||
24 | \Apps\ActiveRecord\User::where('approve_token', '=', '0') |
||
25 | ->update('approve_token', null); |
||
26 | |||
27 | // update comment posts architecture: add app_name and app_id relationship |
||
28 | if (!$this->getSchema()->hasColumn('comment_posts', 'app_name')) { |
||
29 | $this->getSchema()->table('comment_posts', function($table) { |
||
30 | $table->string('app_name')->after('id'); |
||
31 | }); |
||
32 | } |
||
33 | if (!$this->getSchema()->hasColumn('comment_answers', 'app_relation_id')) { |
||
34 | $this->getSchema()->table('comment_answers', function($table){ |
||
35 | $table->integer('app_relation_id')->unsigned()->default(0)->after('app_name'); |
||
36 | }); |
||
37 | } |
||
38 | |||
39 | \Apps\ActiveRecord\App::whereIn('sys_name', static::UPDATE_EXTENSIONS) |
||
40 | ->update(['version' => '1.0.1']); |
||
41 | |||
42 | // @todo: add algo to find app_name & app_id for oldest comments |
||
43 | if ($this->getSchema()->hasColumn('comment_posts', 'pathway')) { |
||
44 | $this->getSchema()->table('comment_posts', function($table){ |
||
45 | $table->dropColumn('pathway'); |
||
46 | }); |
||
47 | } |
||
48 | // remove comment_hash column from content |
||
49 | if ($this->getSchema()->hasColumn('contents', 'comment_hash')) { |
||
50 | $this->getSchema()->table('contents', function($table) { |
||
51 | $table->dropColumn('comment_hash'); |
||
52 | }); |
||
53 | } |
||
54 | // remove user login column |
||
55 | if ($this->getSchema()->hasColumn('users', 'login')) { |
||
56 | $this->getSchema()->table('users', function($table) { |
||
57 | $table->dropColumn('login'); |
||
58 | }); |
||
78 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.