drop primary key constraint from userapi_devices.access_token

This commit is contained in:
Roman Isaev 2024-12-31 01:40:14 +00:00
parent ff63e7fa98
commit bf310d558f
No known key found for this signature in database
GPG key ID: 7BE2B6A6C89AEC7F
5 changed files with 111 additions and 12 deletions

View file

@ -0,0 +1,25 @@
package deltas
import (
"context"
"database/sql"
"fmt"
)
func UpDropPrimaryKeyConstraint(ctx context.Context, tx *sql.Tx) error {
_, err := tx.ExecContext(ctx, `
ALTER TABLE userapi_devices DROP CONSTRAINT userapi_devices_pkey;`)
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
return nil
}
func DownDropPrimaryKeyConstraint(ctx context.Context, tx *sql.Tx) error {
_, err := tx.ExecContext(ctx, `
ALTER TABLE userapi_devices ADD CONSTRAINT userapi_devices_pkey PRIMARY KEY (access_token);`)
if err != nil {
return fmt.Errorf("failed to execute downgrade: %w", err)
}
return nil
}