You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix dropTableColumns sqlite implementation
* use droptables and its index dropping support in v78 and v85
* golang-ci fixes
* Add migration from gitea 1.3.3 for sqlite which reveals the droptables bug - thus showing this works
SELECT @ConstraintName = obj.name FROM sys.columns col LEFT OUTER JOIN sys.objects obj ON obj.object_id = col.default_object_id AND obj.type = 'D' WHERE col.object_id = OBJECT_ID('repository') AND obj.name IS NOT NULL AND col.name = 'is_bare'
38
-
SET @SQL = N'ALTER TABLE [repository] DROP CONSTRAINT [' + @ConstraintName + N']'
39
-
EXEC sp_executesql @SQL`)
40
-
iferr!=nil {
41
-
returnerr
42
-
}
43
-
} elseifmodels.DbCfg.Type==core.MYSQL {
44
-
indexes, err:=sess.QueryString(`SHOW INDEX FROM repository WHERE KEY_NAME = 'IDX_repository_is_bare'`)
45
-
iferr!=nil {
46
-
returnerr
47
-
}
48
-
49
-
iflen(indexes) >=1 {
50
-
_, err=sess.Exec("DROP INDEX IDX_repository_is_bare ON repository")
51
-
iferr!=nil {
52
-
returnfmt.Errorf("Drop index failed: %v", err)
53
-
}
54
-
}
55
-
} else {
56
-
_, err=sess.Exec("DROP INDEX IDX_repository_is_bare ON repository")
57
-
}
58
-
59
-
iferr!=nil {
60
-
returnfmt.Errorf("Drop index failed: %v", err)
61
-
}
62
-
63
-
iferr=sess.Commit(); err!=nil {
64
-
returnerr
65
-
}
66
-
67
-
iferr:=sess.Begin(); err!=nil {
68
-
returnerr
69
-
}
70
-
71
24
iferr:=sess.Sync2(new(Repository)); err!=nil {
72
25
returnerr
73
26
}
74
27
if_, err:=sess.Exec("UPDATE repository SET is_empty = is_bare;"); err!=nil {
75
28
returnerr
76
29
}
77
-
78
-
ifmodels.DbCfg.Type!=core.SQLITE {
79
-
_, err=sess.Exec("ALTER TABLE repository DROP COLUMN is_bare")
80
-
iferr!=nil {
81
-
returnfmt.Errorf("Drop column failed: %v", err)
82
-
}
30
+
iferr:=sess.Commit(); err!=nil {
31
+
returnerr
83
32
}
84
33
85
-
iferr=sess.Commit(); err!=nil {
34
+
iferr:=sess.Begin(); err!=nil {
86
35
returnerr
87
36
}
88
-
89
-
ifmodels.DbCfg.Type==core.SQLITE {
90
-
log.Warn("TABLE repository's COLUMN is_bare should be DROP but sqlite is not supported, you could manually do that.")
SELECT @ConstraintName = obj.name FROM sys.columns col LEFT OUTER JOIN sys.objects obj ON obj.object_id = col.default_object_id AND obj.type = 'D' WHERE col.object_id = OBJECT_ID('access_token') AND obj.name IS NOT NULL AND col.name = 'sha1'
51
-
SET @SQL = N'ALTER TABLE [access_token] DROP CONSTRAINT [' + @ConstraintName + N']'
52
-
EXEC sp_executesql @SQL`)
53
-
} elseifmodels.DbCfg.Type==core.MYSQL {
54
-
indexes, err:=sess.QueryString(`SHOW INDEX FROM access_token WHERE KEY_NAME = 'UQE_access_token_sha1'`)
55
-
iferr!=nil {
56
-
returnerr
57
-
}
58
-
59
-
iflen(indexes) >=1 {
60
-
_, err=sess.Exec("DROP INDEX UQE_access_token_sha1 ON access_token")
61
-
iferr!=nil {
62
-
returnerr
63
-
}
64
-
}
65
-
} else {
66
-
_, err=sess.Exec("DROP INDEX UQE_access_token_sha1 ON access_token")
0 commit comments