DROP TABLE IF EXISTS field;

-- DROP SEQUENCE IF EXISTS field_seq;
-- CREATE SEQUENCE field_seq;


CREATE TABLE field (
  "field_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY,
  "field_group_id" int NOT NULL,
  "type" varchar(32) NOT NULL,
  "default" text NOT NULL,
  "settings" text NOT NULL,
  "validation" text NOT NULL,
  "presentation" text NOT NULL,
  "conditionals" text NOT NULL,
  "row" int NOT NULL DEFAULT 0,
  "status" smallint NOT NULL DEFAULT 1,
  "sort_order" int NOT NULL DEFAULT 0
  -- PRIMARY KEY("field_id")
);

-- SELECT setval('field_field_id_seq', 0, true); -- last inserted id by sample data
