Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tinwritescode/af2adb42add49d40f9aec31fa4a635ac to your computer and use it in GitHub Desktop.
Save tinwritescode/af2adb42add49d40f9aec31fa4a635ac to your computer and use it in GitHub Desktop.
CREATE TABLE Res_partner (
Id SERIAL PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
Birthday DATE
);
CREATE TABLE Product_template (
Id SERIAL PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
Uom_id INT,
FOREIGN KEY (Uom_id) REFERENCES Uom_uom(Id)
);
CREATE TABLE Product_product (
Id SERIAL PRIMARY KEY,
Product_tmpl_id INT,
FOREIGN KEY (Product_tmpl_id) REFERENCES Product_template(Id)
);
CREATE TABLE Uom_uom (
Id SERIAL PRIMARY KEY,
Name VARCHAR(255) NOT NULL
);
CREATE TABLE Pos_order (
Id SERIAL PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
Order_date DATE,
Partner_id INT,
Description VARCHAR(255),
FOREIGN KEY (Partner_id) REFERENCES Res_partner(Id)
);
CREATE TABLE Pos_order_line (
Id SERIAL PRIMARY KEY,
Order_id INT,
FOREIGN KEY (Order_id) REFERENCES Pos_order(Id),
Product_id INT,
FOREIGN KEY (Product_id) REFERENCES Product_product(Id),
Uom_id INT,
FOREIGN KEY (Uom_id) REFERENCES Uom_uom(Id),
Quantity NUMERIC,
Price NUMERIC,
Amount NUMERIC,
Description VARCHAR(255)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment