实现 MLS 设备封包投递与离线同步

This commit is contained in:
xhgit committed 2026-11-13 18:21:09 +08:00
1 parent 53164d0fa8
commit f30f01b699
15 files changed
+366 -16

No files matched your search

+4 -1
View File
@@ -13,6 +13,9 @@ var identityMigration string
//go:embed 002_contacts.sql
var contactsMigration string
//go:embed 003_delivery.sql
var deliveryMigration string
func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
tx, err := pool.Begin(ctx)
if err != nil {
@@ -25,7 +28,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} {
for index, migration := range []string{identityMigration, contactsMigration, deliveryMigration} {
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 {