- Issue created by @drp_distruptor
- Status changed to Postponed: needs info
over 1 year ago 1:43pm 15 June 2023 - 🇬🇧United Kingdom pstewart
I've been investigating this, and although I've not been able to recreate I can see how the problem can arises if the table name passed to
Schema::createFieldSql
is prefixed with a schema, as the code uses the table name directly when creating the constraint name:if (isset($spec['default'])) { $default = $this->defaultValueExpression($sqlsrv_type, $spec['default']); $sql .= " CONSTRAINT {{$table}_{$name}_df} DEFAULT $default"; }
What I'm unclear about is how
$table
is acquiring a schema prefix, as I don't see this happening in my dev environments either with or without the schema being defined in settings. The one thing I've not tried is adding a schema via theprefix
setting.@drp_distruptor are you seeing this problem on a pre-existing site or on a new install, and do you see the same problems with the previous release 4.3.1? Also please can you let me know what database settings you are using (without sensitive details of course).
- 🇮🇹Italy drp_distruptor Neaples
With the new version 4.3.3, the issue seems solved by removing the prefix from the settings.local.php
$databases['default']['default'] = [ 'database' => '###', 'username' => '###', 'password' => '###', <strong>'prefix' => '',</strong> 'encrypt' => '0', 'host' => '###', 'port' => '1433', 'namespace' => 'Drupal\\sqlsrv\\Driver\\Database\\sqlsrv', 'driver' => 'sqlsrv', 'autoload' => 'modules/contrib/sqlsrv/src/Driver/Database/sqlsrv', ];
By the way, you should be sure that the default schema is dbo on your user and database.