DROP TABLE IF EXISTS digital_asset;

-- DROP SEQUENCE IF EXISTS digital_asset_digital_asset_id_seq;
-- CREATE SEQUENCE digital_asset_digital_asset_id_seq;


CREATE TABLE digital_asset (
  "digital_asset_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "admin_id" int check ("admin_id" > 0) NOT NULL,
  "file" varchar(160) NOT NULL,
  "public" varchar(128) NOT NULL,
  "created_at" timestamp(0) NOT NULL DEFAULT now()
  -- PRIMARY KEY("digital_asset_id")
);


CREATE INDEX "digital_asset_admin" ON digital_asset ("admin_id");
SELECT setval('digital_asset_digital_asset_id_seq', 1, true); -- last inserted id by sample data