DROP TABLE IF EXISTS return_log;

-- DROP SEQUENCE IF EXISTS return_log_return_log_id_seq;
-- CREATE SEQUENCE return_log_return_log_id_seq;


CREATE TABLE return_log (
  "return_log_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "return_id" int check ("return_id" > 0) NOT NULL,
  "return_status_id" int check ("return_status_id" > 0) NOT NULL,
  "notify" smallint NOT NULL,
  "note" text NOT NULL,
  "created_at" timestamp(0) NOT NULL DEFAULT now()
  -- PRIMARY KEY("return_log_id")
);

CREATE INDEX "return_log_return_id" ON return_log ("return_id");
-- SELECT setval('return_log_return_log_id_seq', 0, true); -- last inserted id by sample data