mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-08 10:46:37 +08:00
fix(backend): force column checks in migration even if schema version is current (#131)
fix(backend): force column checks in migration
This commit is contained in:
@@ -1384,9 +1384,6 @@ func migrateSchema(db *store.DB) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ver >= currentSchemaVersion {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureColumn := func(table, col, typ string) {
|
ensureColumn := func(table, col, typ string) {
|
||||||
var dummy interface{}
|
var dummy interface{}
|
||||||
@@ -1454,6 +1451,10 @@ func migrateSchema(db *store.DB) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ver >= currentSchemaVersion {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
setSchemaVersion(db, currentSchemaVersion)
|
setSchemaVersion(db, currentSchemaVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -1624,10 +1625,10 @@ func isMissingTableError(dialect store.Dialect, err error) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
msg := strings.ToLower(err.Error())
|
msg := strings.ToLower(err.Error())
|
||||||
if dialect == store.DialectPostgres {
|
// Check both PostgreSQL and SQLite patterns for robustness
|
||||||
return strings.Contains(msg, "relation") && strings.Contains(msg, "does not exist")
|
// (tests may use SQLite with DialectPostgres for convenience)
|
||||||
}
|
return (strings.Contains(msg, "relation") && strings.Contains(msg, "does not exist")) ||
|
||||||
return strings.Contains(msg, "no such table")
|
strings.Contains(msg, "no such table")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Repository) CreatePeerShare(share *PeerShare) error {
|
func (r *Repository) CreatePeerShare(share *PeerShare) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user