added example db create script
This commit is contained in:
parent
aa05ea70af
commit
47cc1b0424
7
.idea/sqldialects.xml
generated
Normal file
7
.idea/sqldialects.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$/sql/delete_db.sql" dialect="GenericSQL" />
|
||||||
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, X-Content-Type-Options=nosniff">
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
<link rel="stylesheet" href="styles-main.css">
|
<link rel="stylesheet" href="styles-main.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
CREATE DATABASE 'webshop' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
|
CREATE DATABASE 'webshop' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
|
||||||
|
|
||||||
|
# example link: https://fabric.inc/blog/commerce/ecommerce-database-design-example
|
||||||
|
|
||||||
CREATE TABLE 'user'
|
CREATE TABLE 'user'
|
||||||
(
|
(
|
||||||
id int,
|
id int,
|
||||||
@ -9,5 +11,124 @@ CREATE TABLE 'user'
|
|||||||
email varchar(255),
|
email varchar(255),
|
||||||
passwd varchar(255),
|
passwd varchar(255),
|
||||||
passwd_hash_algo varchar(255),
|
passwd_hash_algo varchar(255),
|
||||||
is_admin bool
|
is_admin bool,
|
||||||
)
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'user_address'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
userid int,
|
||||||
|
address_line1 varchar(255),
|
||||||
|
address_line2 varchar(255),
|
||||||
|
city varchar(255),
|
||||||
|
postal_code varchar(255),
|
||||||
|
country varchar(255),
|
||||||
|
telephone varchar(255),
|
||||||
|
mobile varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'user_payment'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
user_id int,
|
||||||
|
payment_type varchar(255),
|
||||||
|
provider varchar(255),
|
||||||
|
account_no int,
|
||||||
|
expiry date
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'shopping_session'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
user_id varchar(255),
|
||||||
|
total decimal,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'cart_item'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
session_id int,
|
||||||
|
product_id int,
|
||||||
|
quantity int,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'payment_details'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
order_id int,
|
||||||
|
amount int,
|
||||||
|
provider varchar(255),
|
||||||
|
status varchar(255),
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'order_items'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
order_id int,
|
||||||
|
product_id int,
|
||||||
|
quantity int,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'order_details'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
user_id varchar(255),
|
||||||
|
total decimal,
|
||||||
|
payment_id int,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'product'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
name varchar(255),
|
||||||
|
desc text,
|
||||||
|
SKU varchar(255),
|
||||||
|
category_id int,
|
||||||
|
inventory_id int,
|
||||||
|
price decimal,
|
||||||
|
discount_id int,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp,
|
||||||
|
deleted_at timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE 'product_category'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
name varchar(255),
|
||||||
|
desc text,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp,
|
||||||
|
deleted_at timestamp
|
||||||
|
);
|
||||||
|
CREATE TABLE 'product_inventory'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
quantity int,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp,
|
||||||
|
deleted_at timestamp
|
||||||
|
);
|
||||||
|
CREATE TABLE 'discount'
|
||||||
|
(
|
||||||
|
id int,
|
||||||
|
name varchar(255),
|
||||||
|
desc text,
|
||||||
|
discount_percent decimal,
|
||||||
|
active bool,
|
||||||
|
created_at timestamp,
|
||||||
|
modified_at timestamp,
|
||||||
|
deleted_at timestamp
|
||||||
|
)
|
||||||
Loading…
x
Reference in New Issue
Block a user