github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/datastore/postgres/migrations/zz_migration.0014_drop_bigserial_ids.go (about) 1 package migrations 2 3 import ( 4 "context" 5 6 "github.com/jackc/pgx/v5" 7 ) 8 9 var dropIDStmts = []string{ 10 `ALTER TABLE relation_tuple_transaction 11 DROP COLUMN id;`, 12 `ALTER TABLE namespace_config 13 DROP COLUMN id, 14 DROP COLUMN created_transaction, 15 DROP COLUMN deleted_transaction;`, 16 `ALTER TABLE relation_tuple 17 DROP COLUMN id, 18 DROP COLUMN created_transaction, 19 DROP COLUMN deleted_transaction;`, 20 } 21 22 func init() { 23 if err := DatabaseMigrations.Register("drop-bigserial-ids", "drop-id-constraints", 24 noNonatomicMigration, 25 func(ctx context.Context, tx pgx.Tx) error { 26 for _, stmt := range dropIDStmts { 27 if _, err := tx.Exec(ctx, stmt); err != nil { 28 return err 29 } 30 } 31 32 return nil 33 }); err != nil { 34 panic("failed to register migration: " + err.Error()) 35 } 36 }