add v0.3 schema: smtp fields, mailbox roles, drafts, pending actions, mailstore queries
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,49 @@ public enum DatabaseSetup {
|
||||
}
|
||||
}
|
||||
|
||||
migrator.registerMigration("v2_smtp") { db in
|
||||
try db.alter(table: "account") { t in
|
||||
t.add(column: "smtpHost", .text)
|
||||
t.add(column: "smtpPort", .integer)
|
||||
t.add(column: "smtpSecurity", .text)
|
||||
}
|
||||
}
|
||||
|
||||
migrator.registerMigration("v2_mailboxRole") { db in
|
||||
try db.alter(table: "mailbox") { t in
|
||||
t.add(column: "role", .text)
|
||||
}
|
||||
}
|
||||
|
||||
migrator.registerMigration("v2_draft") { db in
|
||||
try db.create(table: "draft") { t in
|
||||
t.primaryKey("id", .text)
|
||||
t.belongsTo("account", onDelete: .cascade).notNull()
|
||||
t.column("inReplyTo", .text)
|
||||
t.column("forwardOf", .text)
|
||||
t.column("toAddresses", .text)
|
||||
t.column("ccAddresses", .text)
|
||||
t.column("bccAddresses", .text)
|
||||
t.column("subject", .text)
|
||||
t.column("bodyText", .text)
|
||||
t.column("createdAt", .text).notNull()
|
||||
t.column("updatedAt", .text).notNull()
|
||||
}
|
||||
}
|
||||
|
||||
migrator.registerMigration("v2_pendingAction") { db in
|
||||
try db.create(table: "pendingAction") { t in
|
||||
t.primaryKey("id", .text)
|
||||
t.belongsTo("account", onDelete: .cascade).notNull()
|
||||
t.column("actionType", .text).notNull()
|
||||
t.column("payload", .text).notNull()
|
||||
t.column("createdAt", .text).notNull()
|
||||
t.column("retryCount", .integer).notNull().defaults(to: 0)
|
||||
t.column("lastError", .text)
|
||||
}
|
||||
try db.create(index: "idx_pendingAction_createdAt", on: "pendingAction", columns: ["createdAt"])
|
||||
}
|
||||
|
||||
return migrator
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user