--up
CREATE TABLE user_email_cold_storage (
    id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    "user_id" integer REFERENCES users (id) ON UPDATE RESTRICT ON DELETE CASCADE NOT NULL,
    "in_storage" boolean NOT NULL DEFAULT TRUE,
    "created_at" timestamp NOT NULL DEFAULT NOW(),
    "updated_at" timestamp NOT NULL DEFAULT NOW()
);

CREATE TRIGGER set_timestamp
BEFORE UPDATE ON user_email_cold_storage FOR EACH ROW
EXECUTE PROCEDURE update_updated_at_column();

--down

DROP TABLE user_email_cold_storage;
