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

Remove If Exist check on migration for mssql because that syntax required SQL server 2016 #30894

Merged
merged 8 commits into from May 11, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented May 8, 2024

Fix #30872

We will assume the database is consistent before executing the migration. So the indexes should exist. Removing IF EXIST then is safe enough.

@lunny lunny added type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels May 8, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 8, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 8, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels May 8, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 8, 2024
@yp05327
Copy link
Contributor

yp05327 commented May 8, 2024

Can we catch the error when index not existing, then only show a warning, and return no error?
Maybe CI failure related.

@lunny
Copy link
Member Author

lunny commented May 8, 2024

Can we catch the error when index not existing, then only show a warning, and return no error? Maybe CI failure related.

CI failure is unrelated. It's an actions/setup-go upgrade problem. I think it's hard to catch the error of MSSQL for different versions. And it should be right, otherwise it means Gitea's database has been broken in previous migrations or situations.

@silverwind
Copy link
Member

silverwind commented May 8, 2024

I think we should raise the MSSQL requirement to 2016 for v1.23, e.g. follow the "Security Support" category of https://endoflife.date/mssqlserver.

@yp05327
Copy link
Contributor

yp05327 commented May 8, 2024

@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 10, 2024
Copy link
Contributor

@yp05327 yp05327 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 approvements can be done later.

  • wait for xorm support checking whether index exists
  • raise the MSSQL requirement to 2016 for v1.23

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 11, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 11, 2024
@lunny lunny merged commit 40de54e into go-gitea:main May 11, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone May 11, 2024
@lunny lunny deleted the lunny/fix_migration_sqlserver branch May 11, 2024 14:16
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request May 11, 2024
…ired SQL server 2016 (go-gitea#30894)

Fix go-gitea#30872

We will assume the database is consistent before executing the
migration. So the indexes should exist. Removing `IF EXIST` then is safe
enough.

---------

Co-authored-by: silverwind <me@silverwind.io>
@GiteaBot GiteaBot added backport/done All backports for this PR have been created and removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels May 11, 2024
@silverwind
Copy link
Member

2 approvements can be done later.

* wait for xorm support checking whether index exists

* raise the MSSQL requirement to 2016 for v1.23

#30949 to raise the requirement to 2017.

lunny added a commit that referenced this pull request May 12, 2024
…ired SQL server 2016 (#30894) (#30946)

Backport #30894 by @lunny

Fix #30872

We will assume the database is consistent before executing the
migration. So the indexes should exist. Removing `IF EXIST` then is safe
enough.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 13, 2024
* giteaofficial/main:
  [skip ci] Updated licenses and gitignores
  Fix file path width in repo non-homepage view (go-gitea#30951)
  Enable `declaration-block-no-redundant-longhand-properties` (go-gitea#30950)
  [skip ci] Updated translations via Crowdin
  Move reverproxyauth before session so the header will not be ignored even if user has login (go-gitea#27821)
  Use CSS `inset` shorthand (go-gitea#30939)
  Remove If Exist check on migration for mssql because that syntax required SQL server 2016 (go-gitea#30894)
  Update JS dependencies, add new eslint rules (go-gitea#30840)
  Fix some UI regressions for commit list (go-gitea#30920)
  Forbid deprecated `break-word` in CSS (go-gitea#30934)
  Check if reverse proxy is correctly configured (go-gitea#30890)
  Remove deprecated stuff for runners (go-gitea#30930)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/migrations size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MSSQL error DROP INDEX IF EXISTS: Incorrect syntax near the keyword ‘IF’
5 participants