DROP TABLE IF EXISTS product_field_value;

-- DROP SEQUENCE IF EXISTS product_field_value_field_value_id_seq;
-- CREATE SEQUENCE product_field_value_field_value_id_seq;


CREATE TABLE product_field_value (
  "product_field_value_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY,
  "field_id" int NOT NULL,
  "product_id" int NOT NULL,
  "language_id" int NOT NULL,
  "value" TEXT NOT NULL
  -- PRIMARY KEY("field_value_id")
);

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

CREATE INDEX IF NOT EXISTS "product_field_value_field" ON product_field_value ("field_id");
