-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Fix the v78 migration "Drop is_bare" on MSSQL #6707 #6823
Fix the v78 migration "Drop is_bare" on MSSQL #6707 #6823
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6823 +/- ##
==========================================
- Coverage 41.17% 41.17% -0.01%
==========================================
Files 425 425
Lines 58477 58484 +7
==========================================
+ Hits 24077 24078 +1
- Misses 31215 31221 +6
Partials 3185 3185
Continue to review full report at Codecov.
|
@zeripath we have a drone test about MSSQL. And you can run a mssql database on docker. |
Fixed and confirmed to be working! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop column is still beeded
@lafriks what do you mean? The rest of the migrations don't explicitly drop the column - I think the sync2 does that? |
See below |
Btw why aren't you using dropColumns function: https://github.com/go-gitea/gitea/blob/master/models/migrations/migrations.go#L275 ? |
OK @lafriks I've changed to use dropTableColumns |
|
Oh great so should we not update dropTableColumns to remove constraints on other types too? |
2d4208a
to
a10debc
Compare
I've reverted the change to dropTableColumns as it's not quite the right thing at present. |
This migration has caused many issues to be reported, I'd like to have it in a working state, then we can move the logic of dropping constraints into On a related note: I wonder why our migration tests didn't catch the fail case. I'm guessing it's like that one user reported where they were using an older version of MSSQL. |
So we don't have migration tests for MSSQL as when I wrote the migration tests I didn't have access to MSSQL and it's not entirely clear how to get the T-SQL out of MSSQL. If I knew XORM better I'd say it should be possible to get XORM to just dummy out the sql commands it would use to create and fill the database and we should be able to just store those but I don't know XORM well enough to do that. |
@zeripath so, we need a migration test for MSSQL. |
Yes we do. The correct way to do this, and one that would make it very easy in future to add more migrations is for xorm dump to work correctly - but it doesn't produce valid sql. Another way would be to somehow get xorm to rerun queries from its log. Then we could just store the log - and get xorm to run that. But I can't. The way I made the migration tests in the first case was by breaking in the first integration test and then using that database's way of creating an SQL dump for it. It was extremely fiddly and MSSQL doesn't provide a way of doing that - although there are external things they do this. Xorm dump doesn't produce valid t-sql even when dumping from MSSQL. I have to say it was not automatic to generate dumps postgres or mysql, and that their dumps required manual changes too to make them work. It's a highly unsatisfactory and manual way of making migrations. If xorm dump just worked correctly it would be so much easier. |
Anyway there are multiple users out there who are struggling to get to 1.8 because this migration step is still wrong. If you know a way of getting a t-sql dump out of mssql or can provide a t-sql dump of 1.5.3, 1.6.4 and 1.7.0 I'm happy to add this or we can add it as another pr - however we need to get a fix in. Similarly if you'd prefer that this was rebased on top of #6849 that's fine, but #6849 would also need to be backported. |
Build https://drone.gitea.io/go-gitea/gitea/8698/1/16 shows that when combined with #6851 and #6852 you can see fixes the v78 migration. I'm going to force rebase this back to be just the v78 fix now. |
c0a1c8a
to
3b849c3
Compare
@zeripath merged. Please backport 😃 |
So #6707 appears to be reporting multiple issues with the drop bare constraint on MSSQL.
#6707 (comment)
suggests a piece of code which will try to detect the constraint and execute code to remove it.
This attempts to replicate this code.
Please note I do not have access to MSSQL - so this is untested. (Hence the WIP)