mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-19 12:16:27 +00:00
Fix local account id primary key issue
This commit is contained in:
parent
9c2c46ed82
commit
107de97802
1 changed files with 23 additions and 0 deletions
|
@ -44,6 +44,29 @@ extension IdentityDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
migrator.registerMigration("1.2.0-pk-fix") { db in
|
||||
try db.create(table: "new_account") { t in
|
||||
t.column("id", .text).notNull()
|
||||
t.column("identityId", .text).notNull()
|
||||
.references("identityRecord", onDelete: .cascade)
|
||||
t.column("username", .text).notNull()
|
||||
t.column("displayName", .text).notNull()
|
||||
t.column("url", .text).notNull()
|
||||
t.column("avatar", .text).notNull()
|
||||
t.column("avatarStatic", .text).notNull()
|
||||
t.column("header", .text).notNull()
|
||||
t.column("headerStatic", .text).notNull()
|
||||
t.column("emojis", .blob).notNull()
|
||||
t.column("followRequestCount", .integer).notNull()
|
||||
|
||||
t.primaryKey(["id", "identityId"], onConflict: .replace)
|
||||
}
|
||||
|
||||
try db.execute(sql: "INSERT INTO new_account SELECT * FROM account")
|
||||
try db.drop(table: "account")
|
||||
try db.rename(table: "new_account", to: "account")
|
||||
}
|
||||
|
||||
return migrator
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue