-- P5-2963 create new table for samples

DROP TABLE IF EXISTS samples;

CREATE TABLE samples
(
  id SERIAL PRIMARY KEY,
  artno VARCHAR,
  material_id INTEGER,
  address_id INTEGER
);

ALTER TABLE samples
    ADD CONSTRAINT material_fkey
    FOREIGN KEY (material_id)
    REFERENCES "product-materials"(materialid) MATCH SIMPLE;

ALTER TABLE samples
    ADD CONSTRAINT address_fkey
    FOREIGN KEY (address_id)
    REFERENCES addresses(id) MATCH SIMPLE;
