Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datadict: different results when column is modified between alterColumnSql() and changeTableSQL() #865

Closed
mnewnham opened this issue Sep 5, 2022 · 0 comments · Fixed by #866
Assignees
Labels
bug data dictionary datadict feature
Milestone

Comments

@mnewnham
Copy link
Contributor

mnewnham commented Sep 5, 2022

If the same simple change to the schema of a table is applied to a column using the above 2 methods, the output is completely different. This is because ''changeTableSql()'' does not call the database specific method, but instead uses the generic base method. So using the following change to a table:

'regiondescription C(100) NOTNULL DEFAULT "BILL"';

When passed to ''alterColumnSql()'', the result is

Array
(
    [0] => ALTER TABLE region ALTER COLUMN regiondescription VARCHAR(100) NOT NULL
    [1] => ALTER TABLE region ADD CONSTRAINT DF__region__regiondescription__51a89880 DEFAULT 'BILL' FOR regiondescription
)

When passed to ''changeTableSql()''

Array
(
    [0] => ALTER TABLE region ALTER COLUMN regiondescription VARCHAR(100) DEFAULT 'BILL' NOT NULL
)

In addition, ''changeTableSql()'' now calls the driver specific ''dropColumnSql()'' instead of using the generic method in case of column drops.

This issue was previously reported by @boshrin on #383 For Postgres/xmlSchema but covers all drivers using the datadict feature, thx for the code snippet.

@mnewnham mnewnham added the bug label Sep 5, 2022
@mnewnham mnewnham self-assigned this Sep 5, 2022
@mnewnham mnewnham added the data dictionary datadict feature label Sep 5, 2022
mnewnham added a commit that referenced this issue Sep 5, 2022
The alterTableSql uses core methods instead of driver specific ones, see #865 , #383. Change method to create create change SQL statements.
@mnewnham mnewnham changed the title mssqlnative: different results when column is modified between alterColumnSql() and changeTableSQL() datadict: different results when column is modified between alterColumnSql() and changeTableSQL() Sep 5, 2022
@dregad dregad added this to the v5.22.3 milestone Sep 6, 2022
dregad pushed a commit that referenced this issue Sep 6, 2022
alterTableSql() uses core methods instead of driver-specific ones.
Change method used to create SQL statements.

Fixes #865, #383

Signed-off-by: Damien Regad <dregad@mantisbt.org>
@dregad dregad closed this as completed Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug data dictionary datadict feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants