Kunden-Spezifische Artikeleigenschaften
[kivitendo-erp.git] / sql / Pg-upgrade2 / create_part_customerprices.sql
1 -- @tag: create_part_customerprices
2 -- @description: VK-Preis für jeden Kunden speichern und das Datum der Eingabe
3 -- @depends: release_3_5_1
4
5 CREATE TABLE part_customer_prices (
6   id          SERIAL PRIMARY KEY,
7   parts_id    integer NOT NULL,
8   customer_id integer NOT NULL,
9   customer_partnumber text DEFAULT '',
10   price      numeric(15,5) DEFAULT 0,
11   sortorder  integer DEFAULT 0,
12   lastupdate date DEFAULT now(),
13
14   FOREIGN KEY (parts_id)    REFERENCES parts (id),
15   FOREIGN KEY (customer_id) REFERENCES customer (id)
16 );
17 CREATE INDEX part_customer_prices_parts_id_key    ON part_customer_prices USING btree (parts_id);
18 CREATE INDEX part_customer_prices_customer_id_key ON part_customer_prices USING btree (customer_id);