Browse Source

#3 修正

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

+ 4
- 4
migration.py View File

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


Loading…
Cancel
Save