· 7 years ago · Jun 06, 2018, 12:02 PM
1add column secret_key Schema::TYPE_STRING to table pref_user ...Exception 'yiidbException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Schema::TYPE_STRING' at line 1
2The SQL being executed was: ALTER TABLE `pref_user` ADD `secret_key` Schema::TYPE_STRING'
3
4in /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/db/Schema.php:664
5
6Error Info:
7Array
8(
9[0] => 42000
10[1] => 1064
11[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Schema::TYPE_STRING' at line 1
12)
13
14Stack trace:
15#0 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/db/Command.php(1263): yiidbSchema->convertException(Object(PDOException), 'ALTER TABLE `pr...')
16#1 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/db/Command.php(1075): yiidbCommand->internalExecute('ALTER TABLE `pr...')
17#2 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/db/Migration.php(377): yiidbCommand->execute()
18#3 /var/www/u0498223/public_html/coinfactory.pw/migrations/m180606_092852_add_secret_key_in_user_table.php(16): yiidbMigration->addColumn('pref_user', 'secret_key', 'Schema::TYPE_ST...')
19#4 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(725): m180606_092852_add_secret_key_in_user_table->up()
20#5 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(199): yiiconsolecontrollersBaseMigrateController->migrateUp('m180606_092852_...')
21#6 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(845): yiiconsolecontrollersBaseMigrateController->actionUp(1)
22#7 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(369): yiiconsolecontrollersBaseMigrateController->migrateToVersion('m180606_092852')
23#8 [internal function]: yiiconsolecontrollersBaseMigrateController->actionTo('m180606_092852_...')
24#9 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
25#10 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/base/Controller.php(157): yiibaseInlineAction->runWithParams(Array)
26#11 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/Controller.php(148): yiibaseController->runAction('to', Array)
27#12 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/base/Module.php(528): yiiconsoleController->runAction('to', Array)
28#13 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/Application.php(180): yiibaseModule->runAction('migrate/to', Array)
29#14 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/console/Application.php(147): yiiconsoleApplication->runAction('migrate/to', Array)
30#15 /var/www/u0498223/public_html/coinfactory.pw/vendor/yiisoft/yii2/base/Application.php(386): yiiconsoleApplication->handleRequest(Object(yiiconsoleRequest))
31#16 /var/www/u0498223/public_html/coinfactory.pw/yii(20): yiibaseApplication->run()
32#17 {main}
33
34<?php
35
36use yiidbMigration;
37use yiidbSchema;
38
39class m180606_092852_add_secret_key_in_user_table extends Migration
40{
41 // Use up()/down() to run migration code without a transaction.
42 public function up()
43 {
44 $this->addColumn('{{user}}', 'secret_key', 'Schema::TYPE_STRING');
45 }
46
47 public function down()
48 {
49 $this->dropColumn('{{user}}', 'secret_key');
50 }
51
52}