|
|
@@ -43,7 +43,7 @@ def create_queries ( |
|
|
|
def add_constraints_to_queries ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.table ('queries') as table: |
|
|
|
table.foreign ('user_id').references ('user_id').on ('users').on_update ('cascade').on_delete ('restrict') |
|
|
|
table.foreign ('user_id').references ('id').on ('users').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
|
def create_answers ( |
|
|
@@ -61,7 +61,7 @@ def create_answers ( |
|
|
|
def add_constraints_to_answers ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.table ('answers') as table: |
|
|
|
table.foreign ('query_id').references ('query_id').on ('queries').on_update ('cascade').on_delete ('restrict') |
|
|
|
table.foreign ('query_id').references ('id').on ('queries').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
|
def create_users ( |
|
|
@@ -87,8 +87,8 @@ def create_query_answer_histories ( |
|
|
|
def add_constraints_to_query_answer_histories ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.table ('query_answer_histories') as table: |
|
|
|
table.foreign ('query_id').references ('query_id').on ('queries').on_update ('cascade').on_delete ('cascade') |
|
|
|
table.foreign ('answer_id').references ('answer_id').on ('answers').on_update ('cascade').on_delete ('cascade') |
|
|
|
table.foreign ('query_id').references ('id').on ('queries').on_update ('cascade').on_delete ('cascade') |
|
|
|
table.foreign ('answer_id').references ('id').on ('answers').on_update ('cascade').on_delete ('cascade') |
|
|
|
|
|
|
|
|
|
|
|
class DbConfig (TypedDict): |
|
|
|