diff --git a/bsition/backend/configure.py b/bsition/backend/configure.py index b7b501a..d31e220 100644 --- a/bsition/backend/configure.py +++ b/bsition/backend/configure.py @@ -3,6 +3,7 @@ from dotenv import load_dotenv from bsition.backend.elastic.utils import create_index from bsition.backend.postgres.tables import create_filter, create_sort from bsition.backend.postgres.users import create_user_table +from bsition.backend.postgres.relations import create_relations_tables def configure(): @@ -11,3 +12,4 @@ def configure(): create_filter() create_sort() create_index("test-index") + create_relations_tables() diff --git a/bsition/backend/postgres/relations.py b/bsition/backend/postgres/relations.py index eec4a72..6fbccd6 100644 --- a/bsition/backend/postgres/relations.py +++ b/bsition/backend/postgres/relations.py @@ -23,22 +23,13 @@ def create_relations_tables(): """ CREATE TABLE doc_access ( user_id INTEGER REFERENCES users(id), - doc_id INTEGER, + doc_id TEXT, access_type INTEGER CHECK (access_type IN (1, 2, 3)), PRIMARY KEY (user_id, doc_id) ) """ ) ) - cur.execute( - sql.SQL( - """ - CREATE TABLE public_docs ( - doc_id INTEGER PRIMARY KEY - ) - """ - ) - ) conn.commit()