Skip to content

Instantly share code, notes, and snippets.

@0x8801
Last active December 2, 2015 10:36
Show Gist options
  • Save 0x8801/eb75e7427de999768da8 to your computer and use it in GitHub Desktop.
Save 0x8801/eb75e7427de999768da8 to your computer and use it in GitHub Desktop.
Koodishop SQL
CREATE TABLE koodishop_admin_name(
koodishop_admin_id integer primary key NOT NULL,
koodishop_admin_name text NOT NULL,
koodishop_admin_picture text NOT NULL,
created_at timestamp,
updated_at timestamp
);
CREATE TABLE shop(
shop_id integer primary key NOT NULL,
shop_name text,
shop_logo text,
shop_location text references shops(shop_id),
created_at timestamp,
updated_at timestamp
);
CREATE TABLE cart(
cart_id integer primary key NOT NULL,
cart_itemscart_total_price integer,
cart_item_count integer,
created_at timestamp,
updated_at timestamp
);
CREATE TABLE vouchers(
voucher_id integer primary key NOT NULL,
voucher_owner text NOT NULL,
voucher_item text NOT NULL,
voucher_expiry timestamp NOT NULL,
created_at timestamp,
updated_at timestamp
);
CREATE TABLE shop_managers(
shop_manager_id integer primary key NOT NULL,
shop_manager_name text,
shop_manager_email text,
shop_id integer references shops(shop_id),
created_at timestamp,
updated_at timestamp
);
CREATE TABLE shoppers(
shopper_id integer primary key NOT NULL,
shopper_first_name text,
shopper_second_name text,
shopper_email text,
shopper_phone_number text,
created_at timestamp,
updated_at timestamp
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment