Closed thsmrtone1 closed 1 year ago
Hello!
Not sure about MSSQL — I mainly use PostgreSQL — but with the help of my colleague @Pol-Valentin we face the same issue and investiguate it. Doctrine Migrations, with the help of Doctrine DBAL, check if the version table should be created using AbstractSchemaManager::tableExists
… And this check is performed by comparing the list of all tables with the name of the version table. It may be an issue with the table name comparison… But, for what I read in the code, it should work. The list of tables is retrieved using this SQL query:
SELECT name, SCHEMA_NAME (uid) AS schema_name FROM sysobjects WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name
and the table name is always returned as qualified name except on the dbo
schema :
protected function _getPortableTableDefinition($table)
{
if ($table['schema_name'] !== 'dbo') {
return $table['schema_name'] . '.' . $table['table_name'];
}
return $table['table_name'];
}
👉 So… This not seems to be your issue, but I’m curious about what returns this query on your side:
SELECT name, SCHEMA_NAME (uid) AS schema_name FROM sysobjects WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name
👉 Can you give us the version of your SQL Server and your Doctrine Migrations and DBAL version ?
Edit: Bad library repository 😬
@kipit Thanks for the response! I actually figured out that I had an incorrect value for my schema_filter config value, and it was actually excluding the schema I was trying to use for the migration versions table. Once this was corrected, I no longer had this issue.
However, I seem to have uncovered a different issue regarding schema_filter in which I will open a different issue for.
You can close this issue
DB platform: MSSQL (sqlsrv)
Using the following config:
The first time I execute the migration, it will successfully run, and will automatically create the MigrationVersions table within the alt_schema schema. However, on subsequent migrations, I will receive the following error: