added zones and locations tables
This commit is contained in:
parent
12b838ab3c
commit
ae878fd66c
Binary file not shown.
4
main.py
4
main.py
@ -125,6 +125,8 @@ def delete_site(site_name):
|
||||
drop_table(f'sites/{site_name}/sql/drop/brands.sql')
|
||||
drop_table(f'sites/{site_name}/sql/drop/food_info.sql')
|
||||
drop_table(f'sites/{site_name}/sql/drop/logistics_info.sql')
|
||||
drop_table(f'sites/{site_name}/sql/drop/zones.sql')
|
||||
drop_table(f'sites/{site_name}/sql/drop/locations.sql')
|
||||
|
||||
def create_site(site_name):
|
||||
create_table(f'sites/{site_name}/sql/create/logins.sql')
|
||||
@ -136,6 +138,8 @@ def create_site(site_name):
|
||||
create_table(f'sites/{site_name}/sql/create/item_info.sql')
|
||||
create_table(f'sites/{site_name}/sql/create/logistics_info.sql')
|
||||
create_table(f'sites/{site_name}/sql/create/item.sql')
|
||||
create_table(f'sites/{site_name}/sql/create/zones.sql')
|
||||
create_table(f'sites/{site_name}/sql/create/locations.sql')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
9
sites/default/sql/create/locations.sql
Normal file
9
sites/default/sql/create/locations.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS %sitename%_locations(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
zone_id INTEGER NOT NULL,
|
||||
UNIQUE(name),
|
||||
CONSTRAINT fk_zone
|
||||
FOREIGN KEY(zone_id)
|
||||
REFERENCES %sitename%_zones(id)
|
||||
);
|
||||
5
sites/default/sql/create/zones.sql
Normal file
5
sites/default/sql/create/zones.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS %sitename%_zones(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
UNIQUE(name)
|
||||
);
|
||||
1
sites/default/sql/drop/locations.sql
Normal file
1
sites/default/sql/drop/locations.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE %sitename%_locations CASCADE;
|
||||
@ -1 +1 @@
|
||||
DELETE TABLE %sitename%_logistics_info CASCADE;
|
||||
DROP TABLE %sitename%_logistics_info CASCADE;
|
||||
1
sites/default/sql/drop/zones.sql
Normal file
1
sites/default/sql/drop/zones.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE %sitename%_zones CASCADE;
|
||||
@ -1,4 +1,4 @@
|
||||
[site]
|
||||
site_name=main
|
||||
site_owner=
|
||||
site_owner=jadowyne
|
||||
email=
|
||||
|
||||
9
sites/main/sql/create/locations.sql
Normal file
9
sites/main/sql/create/locations.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS main_locations(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
zone_id INTEGER NOT NULL,
|
||||
UNIQUE(name),
|
||||
CONSTRAINT fk_zone
|
||||
FOREIGN KEY(zone_id)
|
||||
REFERENCES main_zones(id)
|
||||
);
|
||||
5
sites/main/sql/create/zones.sql
Normal file
5
sites/main/sql/create/zones.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS main_zones(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
UNIQUE(name)
|
||||
);
|
||||
1
sites/main/sql/drop/locations.sql
Normal file
1
sites/main/sql/drop/locations.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE main_locations CASCADE;
|
||||
@ -1 +1 @@
|
||||
DELETE TABLE main_logistics_info CASCADE;
|
||||
DROP TABLE main_logistics_info CASCADE;
|
||||
1
sites/main/sql/drop/zones.sql
Normal file
1
sites/main/sql/drop/zones.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE main_zones CASCADE;
|
||||
Loading…
x
Reference in New Issue
Block a user