bmc_hub/migrations/1067_workflow_customer_activation.sql

13 lines
708 B
SQL

-- Per-customer preferences never enable the global workflow master switch.
CREATE TABLE IF NOT EXISTS bmc_workflow_customer_activation (
customer_id INTEGER PRIMARY KEY REFERENCES customers(id) ON DELETE CASCADE,
enabled BOOLEAN NOT NULL,updated_by INTEGER REFERENCES users(user_id) ON DELETE SET NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE IF NOT EXISTS bmc_workflow_customer_activation_history (
id BIGSERIAL PRIMARY KEY,customer_id INTEGER NOT NULL,before_enabled BOOLEAN,
after_enabled BOOLEAN NOT NULL,inherited_enabled BOOLEAN NOT NULL,
actor_id INTEGER REFERENCES users(user_id) ON DELETE SET NULL,reason TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);