DROP TABLE IF EXISTS user_field_value;

-- DROP SEQUENCE IF EXISTS user_field_value_user_field_value_id_seq;
-- CREATE SEQUENCE user_field_value_user_field_value_id_seq;


CREATE TABLE user_field_value (
  "user_field_value_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY,
  "language_id" int NOT NULL,
  "user_id" int NOT NULL,
  "field_id" int NOT NULL,
  "sort_order" int NOT NULL DEFAULT 0
  -- PRIMARY KEY("user_field_value_id")
);

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

CREATE INDEX IF NOT EXISTS "user_field_value_field" ON user_field_value ("field_id");
