mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-24 13:38:26 -06:00
Update foreign key constraints in database migrations
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id UUID NOT NULL DEFAULT uuid_generate_v4() PRIMARY KEY,
|
||||
user_id UUID NOT NULL REFERENCES users(id),
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
token TEXT NOT NULL UNIQUE,
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS backups (
|
||||
id UUID NOT NULL DEFAULT uuid_generate_v4() PRIMARY KEY,
|
||||
database_id UUID NOT NULL REFERENCES databases(id),
|
||||
destination_id UUID NOT NULL REFERENCES destinations(id),
|
||||
database_id UUID NOT NULL REFERENCES databases(id) ON DELETE CASCADE,
|
||||
destination_id UUID NOT NULL REFERENCES destinations(id) ON DELETE CASCADE,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
cron_expression TEXT NOT NULL UNIQUE,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS executions (
|
||||
id UUID NOT NULL DEFAULT uuid_generate_v4() PRIMARY KEY,
|
||||
backup_id UUID NOT NULL REFERENCES backups(id),
|
||||
backup_id UUID NOT NULL REFERENCES backups(id) ON DELETE CASCADE,
|
||||
|
||||
status TEXT NOT NULL CHECK (
|
||||
status IN ('running', 'success', 'failed', 'deleted')
|
||||
|
||||
Reference in New Issue
Block a user