CREATE TABLE subscriptions (
    id SERIAL,
    subscription_target_id INTEGER NOT NULL,
    event_stream_id INTEGER NOT NULL,
    status VARCHAR (64) NOT NULL,
    error TEXT NOT NULL,
    aws_lease_id INTEGER,

    PRIMARY KEY (id),
    CONSTRAINT subscriptions_subscription_target_id_fkey FOREIGN KEY (subscription_target_id) REFERENCES subscription_targets (id)
        ON UPDATE CASCADE,
    CONSTRAINT subscriptions_event_stream_id_fkey FOREIGN KEY (event_stream_id) REFERENCES event_streams (id)
        ON UPDATE CASCADE,
    CONSTRAINT subscriptions_lease_id_fkey FOREIGN KEY (aws_lease_id) REFERENCES aws_leases (id)
        ON UPDATE CASCADE
);
