|
|
@@ -42,7 +42,7 @@ def create_queries ( |
|
|
|
|
|
|
|
def add_constraints_to_queries ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.create ('queries') as table: |
|
|
|
with SCHEMA.table ('queries') as table: |
|
|
|
table.foreign ('user_id').references ('user_id').on ('users').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
@@ -60,7 +60,7 @@ def create_answers ( |
|
|
|
|
|
|
|
def add_constraints_to_answers ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.create ('answers') as table: |
|
|
|
with SCHEMA.table ('answers') as table: |
|
|
|
table.foreign ('query_id').references ('query_id').on ('queries').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
@@ -86,7 +86,7 @@ def create_query_answer_histories ( |
|
|
|
|
|
|
|
def add_constraints_to_query_answer_histories ( |
|
|
|
) -> None: |
|
|
|
with SCHEMA.create ('query_answer_histories') as table: |
|
|
|
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') |
|
|
|
|
|
|
|