Add a table of tags and categories

This commit is contained in:
LoRiot 2022-10-15 17:17:10 +03:00
parent 6e20fd1ffe
commit 58bf722a97

View file

@ -11,8 +11,24 @@ async def init_tables(connection: Connection):
is_admin boolean DEFAULT FALSE \
);
"""
await connection.execute(init_users_query)
init_tags_query = """
CREATE TABLE tags ( \
id SERIAL PRIMARY KEY, \
name varchar(100) \
);
"""
await connection.execute(init_tags_query)
init_categories_query = """
CREATE TABLE categories ( \
id SERIAL PRIMARY KEY, \
name varchar(20) \
);
"""
await connection.execute(init_categories_query)
init_projects_query = """
CREATE TABLE projects (
id SERIAL PRIMARY KEY, \
@ -21,8 +37,8 @@ async def init_tables(connection: Connection):
creator bigint REFERENCES users, \
contributors smallint DEFAULT 1, \
status bit(1) DEFAULT B'1', \
tag varchar(100), \
category varchar(20), \
tag int REFERENCES tags, \
category int REFERENCES categories, \
creation_date date DEFAULT CURRENT_DATE \
);
"""