Restore compatibility with SQLServer 2008 R2 in migrations (#16627) #16638

Merged
lunny merged 2 commits from backport-16627-v1.15 into release/v1.15 2021-08-08 10:32:08 +00:00
Contributor

Backport #16627

This fixes two problems with MSSQL:

  • ALTER TABLE DROP ... IF EXISTS ... is only supported in SQL Server >16.

The IF EXISTS here is a belt-and-braces and does not need to be present. Therefore
can be dropped. Also stop attempting to drop the indexes as constraints as they're indexes!

  • System tables like: sys.indexes should be lowercase not uppercase because of collation issues.

Fix #16625
Fix #13615
Fix #16483

Signed-off-by: Andrew Thornton art27@cantab.net

Backport #16627 This fixes two problems with MSSQL: * `ALTER TABLE DROP ... IF EXISTS ...` is only supported in SQL Server >16. The `IF EXISTS` here is a belt-and-braces and does not need to be present. Therefore can be dropped. Also stop attempting to drop the indexes as constraints as they're indexes! * System tables like: `sys.indexes` should be lowercase not uppercase because of collation issues. Fix #16625 Fix #13615 Fix #16483 Signed-off-by: Andrew Thornton <art27@cantab.net>
lunny approved these changes 2021-08-08 10:11:37 +00:00
lafriks (Migrated from github.com) approved these changes 2021-08-08 10:31:57 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#16638
No description provided.