Browse Source

#3 SCHEMA.create を何回も呼んでたとこ修正

main
みてるぞ 1 month ago
parent
commit
c00b426bf9
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      migration.py

+ 3
- 3
migration.py View File

@@ -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')



Loading…
Cancel
Save