Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team B's Pull Request #4

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions modeling/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
system
10 changes: 10 additions & 0 deletions modeling/db/migrations/20180916062355-create_user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

-- +migrate Up
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
PRIMARY KEY(id)
);

-- +migrate Down
DROP TABLE users;
10 changes: 10 additions & 0 deletions modeling/db/migrations/20180916062416-create_vegetables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

-- +migrate Up
CREATE TABLE vegetables (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
PRIMARY KEY(id)
);

-- +migrate Down
DROP TABLE vegetables;
15 changes: 15 additions & 0 deletions modeling/db/migrations/20180916062433-create_order_history.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

-- +migrate Up
CREATE TABLE order_history (
id INT NOT NULL AUTO_INCREMENT,
user_id INT NOT NULL,
vegetable_id INT NOT NULL,
`date` DATE NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES users(id),
FOREIGN KEY(vegetable_id) REFERENCES vegetables(id)
);


-- +migrate Down
DROP TABLE order_history;
11 changes: 11 additions & 0 deletions modeling/db/migrations/20180916074217-create_pex.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- +migrate Up
CREATE TABLE pex (
pex_id VARCHAR(255) NOT NULL,
user_id INT NOT NULL,
PRIMARY KEY(pex_id),
FOREIGN KEY(user_id) REFERENCES users(id)
);

-- +migrate Down
DROP TABLE pex;
;
10 changes: 10 additions & 0 deletions modeling/db/migrations/20180916074220-create_external_service.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

-- +migrate Up
CREATE TABLE external_service (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(25) NOT NULL,
PRIMARY KEY(id)
);

-- +migrate Down
DROP TABLE external_service;
15 changes: 15 additions & 0 deletions modeling/db/migrations/20180916074229-create_point_exchange.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

-- +migrate Up
CREATE TABLE point_exchange (
id INT NOT NULL AUTO_INCREMENT,
point INT NOT NULL,
date DATE NOT NULL,
service_id INT NOT NULL,
user_id INT NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(service_id) REFERENCES external_service(id),
FOREIGN KEY(user_id) REFERENCES users(id)
);

-- +migrate Down
DROP TABLE point_exchange;
14 changes: 14 additions & 0 deletions modeling/db/migrations/20180916083413-create_vegetable_point.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

-- +migrate Up
CREATE TABLE vegetable_point (
id INT NOT NULL AUTO_INCREMENT,
vegetable_id INT NOT NULL,
point INT NOT NULL,
start DATE NOT NULL,
end DATE NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(vegetable_id) REFERENCES vegetables(id)
);

-- +migrate Down
DROP TABLE vegetable_point;