--up
CREATE TABLE paddle_webhooks_events (
    id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    user_id integer REFERENCES users(id),
    paddle_customer_id text,
    created_at timestamp without time zone NOT NULL DEFAULT now(),
    updated_at timestamp without time zone NOT NULL DEFAULT now(),
    type text NOT NULL,
    payload jsonb NOT NULL
);

ALTER TABLE users ADD COLUMN "paddle_customer_id" text;

ALTER TABLE plans ADD COLUMN "paddle_price_id_env_var" text;

--down
DROP TABLE paddle_webhooks_events;
ALTER TABLE users DROP COLUMN paddle_customer_id;
ALTER TABLE plans DROP COLUMN paddle_price_id_env_var;
