stock/stock.sql

44 lines
892 B
SQL

CREATE TABLE Stock_users (
id serial primary key,
mail text not NULL,
password text not NULL,
name text not NULL
);
CREATE TABLE Stock_kits (
id serial primary key,
name text not NULL,
description text not NULL
);
CREATE TABLE Stock_providers (
id serial primary key,
address text not NULL,
mail text not NULL,
url text not NULL,
comment text not NULL
);
CREATE TABLE Stock_componants (
id serial primary key,
name text not NULL,
description text not NULL,
last_price NUMERIC not NULL,
mean_price NUMERIC not NULL,
quantity NUMERIC not NULL,
min_quantity NUMERIC not NULL,
place text not NULL,
provider_id integer REFERENCES Stock_providers(id)
);
CREATE TABLE Stock_kit_compositions (
id serial primary key,
kit_id integer REFERENCES Stock_kits(id),
componant_id integer REFERENCES Stock_componants(id),
quantity integer not NULL
);