Skip to content

Run generated migration in MultiDbSecondaryMigrationTest and other pertinent test file  #6

@SOHELAHMED7

Description

@SOHELAHMED7

Run following (in Docker container)

phpunit --filter '/MultiDbSecondaryMigrationTest::testPostgresCustom$/'
cd tests
./yii migrate-pgsql

Error:

$ ./yii migrate-pgsql
Yii Migration Tool (based on Yii v2.0.50)

Total 1 new migration to be applied:
	m200000_000000_change_table_v3_pgcustom

Apply the above migration? (yes|no) [no]:yes
*** applying m200000_000000_change_table_v3_pgcustom
    > alter column json1 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json1 in table {{%v3_pgcustom}} to SET DEFAULT '[]' ... done (time: 0.000s)
    > alter column json2 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json2 in table {{%v3_pgcustom}} to SET DEFAULT '[]' ... done (time: 0.000s)
    > alter column json3 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json3 in table {{%v3_pgcustom}} to SET DEFAULT '[{"foo":"foobar"},{"xxx":"yyy"}]' ... done (time: 0.000s)
    > alter column json4 in table {{%v3_pgcustom}} to SET NOT NULL ... done (time: 0.000s)
    > alter column json4 in table {{%v3_pgcustom}} to SET DEFAULT '{"foo":"bar","bar":"baz"}' ... done (time: 0.000s)
    > alter column status in table {{%v3_pgcustom}} to SET DEFAULT 'draft' ... done (time: 0.000s)
    > alter column status_x in table {{%v3_pgcustom}} to SET DEFAULT 'draft' ... done (time: 0.000s)
    > create unique index v3_pgcustom_search_gin_index on {{%v3_pgcustom}} (search) ...Exception: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "("
LINE 1: ...custom" USING gin(to_tsvector('english', status)) ("search")
                                                             ^
The SQL being executed was: CREATE INDEX "v3_pgcustom_search_gin_index" ON "itt_v3_pgcustom" USING gin(to_tsvector('english', status)) ("search") (/app/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /app/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'CREATE INDEX "v...')
#1 /app/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('CREATE INDEX "v...')
#2 /app/vendor/yiisoft/yii2/db/Migration.php(506): yii\db\Command->execute()
#3 /app/tests/tmp/docker_app/migrations_pgsql_db/m200000_000000_change_table_v3_pgcustom.php(20): yii\db\Migration->createIndex('v3_pgcustom_sea...', '{{%v3_pgcustom}...', 'search', 'gin(to_tsvector...')
#4 /app/vendor/yiisoft/yii2/db/Migration.php(114): m200000_000000_change_table_v3_pgcustom->safeUp()
#5 /app/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): yii\db\Migration->up()
#6 /app/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(216): yii\console\controllers\BaseMigrateController->migrateUp('m200000_000000_...')
#7 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#8 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#9 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#10 /app/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)
#11 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('', Array)
#12 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate-pgsql', Array)
#13 /app/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate-pgsql', Array)
#14 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(yii\console\Request))
#15 /app/tests/yii(6): yii\base\Application->run()
#16 {main}
*** failed to apply m200000_000000_change_table_v3_pgcustom (time: 0.003s)


0 from 1 migrations were applied.

Migration failed. The rest of the migrations are canceled.

Fix this error.

Also run generated migrations in other pertinent tests file and checks if it runs successfully.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions