绑定设备身份并分发一次性 MLS 密钥包

This commit is contained in:
xhgit committed 2026-11-13 18:27:10 +08:00
1 parent f30f01b699
commit 0b17dd07c5
11 files changed
+286 -11

No files matched your search

+4 -1
View File
@@ -16,6 +16,9 @@ var contactsMigration string
//go:embed 003_delivery.sql
var deliveryMigration string
//go:embed 004_key_packages.sql
var keyPackagesMigration string
func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
tx, err := pool.Begin(ctx)
if err != nil {
@@ -28,7 +31,7 @@ func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
if _, err = tx.Exec(ctx, "CREATE TABLE IF NOT EXISTS schema_migrations (version integer PRIMARY KEY)"); err != nil {
return err
}
for index, migration := range []string{identityMigration, contactsMigration, deliveryMigration} {
for index, migration := range []string{identityMigration, contactsMigration, deliveryMigration, keyPackagesMigration} {
version := index + 1
var applied bool
if err = tx.QueryRow(ctx, "SELECT EXISTS (SELECT 1 FROM schema_migrations WHERE version=$1)", version).Scan(&applied); err != nil {