bmc_hub/migrations/1058_case_command_batches.sql

19 lines
775 B
MySQL
Raw Permalink Normal View History

-- Additive ledger. Batch effects and result are committed in the same transaction.
CREATE TABLE IF NOT EXISTS sag_command_batches (
request_id UUID PRIMARY KEY,
sag_id INTEGER NOT NULL REFERENCES sag_sager(id),
actor_id INTEGER NOT NULL REFERENCES users(user_id),
payload_hash TEXT NOT NULL,
result JSONB NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE sag_todo_steps ADD COLUMN IF NOT EXISTS assigned_to_user_id INTEGER REFERENCES users(user_id);
CREATE TABLE IF NOT EXISTS sag_command_mail_drafts (
id SERIAL PRIMARY KEY,
sag_id INTEGER NOT NULL REFERENCES sag_sager(id),
actor_id INTEGER NOT NULL REFERENCES users(user_id),
subject TEXT NOT NULL,
body TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);