SallyMcGrath / CYF-Signposts

0 stars 0 forks source link

Test #1

Open SallyMcGrath opened 1 year ago

SallyMcGrath commented 1 year ago
erDiagram
    customers {
        id INT PK
        name VARCHAR(50) NOT NULL
        address VARCHAR(120)
        city VARCHAR(30)
        country VARCHAR(20)
    }
    suppliers {
        id INT PK
        supplier_name VARCHAR(100) NOT NULL
        country VARCHAR(20) NOT NULL
    }
    products {
        id INT PK
        product_name VARCHAR(100) NOT NULL
    }
    product_availability {
        prod_id INT REFERENCES products(id)
        supp_id INT REFERENCES suppliers(id)
        unit_price INT NOT NULL
        PRIMARY KEY (prod_id, supp_id)
    }
    orders {
        id INT PK
        order_date DATE NOT NULL
        order_reference VARCHAR(10) NOT NULL
        customer_id INT REFERENCES customers(id)
    }
    order_items {
        id INT PK
        order_id INT NOT NULL REFERENCES orders(id)
        product_id INT NOT NULL REFERENCES products(id)
        supplier_id INT NOT NULL REFERENCES suppliers(id)
        quantity INT NOT NULL
    }

    customers ||--o{ orders : places
    orders }|--|| order_items : contains
    products ||--o{ order_items : contains
    suppliers ||--o{ product_availability : supplies
    products ||--o{ product_availability : has
SallyMcGrath commented 1 year ago
erDiagram
    CUSTOMER ||--o{ ORDER : places
    CUSTOMER {
        string name
        string custNumber
        string sector
    }
    ORDER ||--|{ LINE-ITEM : contains
    ORDER {
        int orderNumber
        string deliveryAddress
    }
    LINE-ITEM {
        string productCode
        int quantity
        float pricePerUnit
    }
SallyMcGrath commented 1 year ago
flowchart TD
    A[Save file] --> B{Lighthouse 100?}
    B -->|No| C[Read feedback]
    C --> D[Revise code]
    D --> B
    B ---->|Yes| E[PR!]
SallyMcGrath commented 1 year ago
Table Name Columns
customers id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, address VARCHAR(120), city VARCHAR(30), country VARCHAR(20)
suppliers id SERIAL PRIMARY KEY, supplier_name VARCHAR(100) NOT NULL, country VARCHAR(20) NOT NULL
products id SERIAL PRIMARY KEY, product_name VARCHAR(100) NOT NULL
product_availability prod_id integer references products(id), supp_id integer references suppliers(id), unit_price integer not null, primary key (prod_id, supp_id)
orders id SERIAL PRIMARY KEY, order_date DATE NOT NULL, order_reference VARCHAR(10) NOT NULL, customer_id INT REFERENCES customers(id)
order_items id SERIAL PRIMARY KEY, order_id INT NOT NULL REFERENCES orders(id), product_id INT NOT NULL REFERENCES products(id), supplier_id INT NOT NULL REFERENCES suppliers(id), quantity INT NOT NULL, FOREIGN KEY (product_id, supplier_id) REFERENCES product_availability (prod_id, supp_id)
SallyMcGrath commented 1 year ago

Table: customers

id name address city country
varchar(50) not null varchar(120) varchar(30) varchar(20)

Table: suppliers

id supplier_name country
varchar(100) not null varchar(20) not null

Table: products

id product_name
varchar(100) not null

Table: product_availability

prod_id supp_id unit_price
integer references products(id) integer references suppliers(id) integer not null

Table: orders

id order_date order_reference customer_id
date not null varchar(10) not null integer references customers(id)

Table: order_items

id order_id product_id supplier_id quantity
integer not null references orders(id) integer not null integer not null integer not null