8000 SQL Server: `ALTER TABLE foo ALTER COLUMN bar NVARCHAR(36) NOT NULL` throws "The index 'idx_foo' is dependent on column 'foo'" · Issue #6913 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
SQL Server: ALTER TABLE foo ALTER COLUMN bar NVARCHAR(36) NOT NULL throws "The index 'idx_foo' is dependent on column 'foo'" #6913
Open
@savemetenminutes

Description

@savemetenminutes

Bug Report

Q A
Version x.y.z
Previous Version if the bug is a regression x.y.z

Summary

SQL Server

It seems that trying to change a column
E.g.

$table->getColumn('foo')->setNotnull(true);

on a column that is referenced in an index results in an error. I would assume this is also true for any constraints associated with the column as well.

Current behavior

  [Doctrine\DBAL\Exception\DriverException]
  An exception occurred while executing a query: SQLSTATE[42000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]The index 'idx_un_sales_bm_company_category_uuid' is dependent on column 'uuid'.

Expected behavior

This can potentially be worked around by dropping all indexes and constraints, which reference the column that has to be changed and then recreating them after the ALTER TABLE ... statement has completed.

How to reproduce

To be provided...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0