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:
2026-03-14 05:01:17 +01:00
parent 8c3f51adb4
commit d659ed67de
10 changed files with 734 additions and 3 deletions
@@ -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
}