Files
mal/internal/database/migrations/012_remove_recovery_key.sql
mkelvers 3f6da13299 fix: remove explicit transaction from migration 012
Goose wraps each migration in a transaction automatically.
Explicit BEGIN TRANSACTION/COMMIT caused a nested transaction
error in SQLite.
2026-05-13 13:46:44 +02:00

22 lines
433 B
SQL

-- +goose Up
PRAGMA foreign_keys = OFF;
CREATE TABLE user_new (
id TEXT PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO user_new (id, username, password_hash, created_at)
SELECT id, username, password_hash, created_at
FROM user;
DROP TABLE user;
ALTER TABLE user_new RENAME TO user;
PRAGMA foreign_keys = ON;
-- +goose Down