Add a table of tags and categories
This commit is contained in:
parent
6e20fd1ffe
commit
58bf722a97
|
@ -11,8 +11,24 @@ async def init_tables(connection: Connection):
|
||||||
is_admin boolean DEFAULT FALSE \
|
is_admin boolean DEFAULT FALSE \
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
await connection.execute(init_users_query)
|
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 = """
|
init_projects_query = """
|
||||||
CREATE TABLE projects (
|
CREATE TABLE projects (
|
||||||
id SERIAL PRIMARY KEY, \
|
id SERIAL PRIMARY KEY, \
|
||||||
|
@ -21,8 +37,8 @@ async def init_tables(connection: Connection):
|
||||||
creator bigint REFERENCES users, \
|
creator bigint REFERENCES users, \
|
||||||
contributors smallint DEFAULT 1, \
|
contributors smallint DEFAULT 1, \
|
||||||
status bit(1) DEFAULT B'1', \
|
status bit(1) DEFAULT B'1', \
|
||||||
tag varchar(100), \
|
tag int REFERENCES tags, \
|
||||||
category varchar(20), \
|
category int REFERENCES categories, \
|
||||||
creation_date date DEFAULT CURRENT_DATE \
|
creation_date date DEFAULT CURRENT_DATE \
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
|
|
Reference in a new issue