DROP TABLE IF EXISTS subscription_log;

-- DROP SEQUENCE IF EXISTS subscription_log_subscription_log_id_seq;
-- CREATE SEQUENCE subscription_log_subscription_log_id_seq;

CREATE TABLE "subscription_log" (
  "subscription_log_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "subscription_id" INT NOT NULL,
  "subscription_status_id" INT NOT NULL,
  "notify" smallint NOT NULL DEFAULT 0,
  "note" text NOT NULL,
  "created_at" timestamp(0) NOT NULL DEFAULT now()
-- PRIMARY KEY ("subscription_log_id")
);

CREATE INDEX "subscription_log_subscription_id" ON "subscription_log" ("subscription_id");
-- SELECT setval('subscription_log_subscription_log_id_seq', 0, true); -- last inserted id by sample data