Browse Source

#3 Nullable だから外部キー制約つけられねぇや

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

+ 0
- 7
migration.py View File

@@ -21,7 +21,6 @@ def main (
create_answers ()
create_users ()
create_query_answer_histories ()
add_constraints_to_queries ()
add_constraints_to_answers ()
add_constraints_to_query_answer_histories ()

@@ -40,12 +39,6 @@ def create_queries (
table.boolean ('answered').default (False).comment ('回答済')


def add_constraints_to_queries (
) -> None:
with SCHEMA.table ('queries') as table:
table.foreign ('user_id').references ('id').on ('users').on_update ('cascade').on_delete ('restrict')


def create_answers (
) -> None:
with SCHEMA.create ('answers') as table:


Loading…
Cancel
Save