| @@ -28,7 +28,7 @@ def create_queries ( | |||||
| ) -> None: | ) -> None: | ||||
| with SCHEMA.create ('queries') as table: | with SCHEMA.create ('queries') as table: | ||||
| table.big_increments ('id') | table.big_increments ('id') | ||||
| table.big_integer ('user_id').nullable ().comment ('クエリ主') | |||||
| table.big_integer ('user_id').unsigned ().nullable ().comment ('クエリ主') | |||||
| table.integer ('target_character').comment ('クエリ先キャラクタ') | table.integer ('target_character').comment ('クエリ先キャラクタ') | ||||
| table.text ('content').comment ('クエリ内容') | table.text ('content').comment ('クエリ内容') | ||||
| table.string ('image_url').nullable ().default (None).comment ('添附画像 URL') | table.string ('image_url').nullable ().default (None).comment ('添附画像 URL') | ||||
| @@ -42,7 +42,7 @@ def create_answers ( | |||||
| ) -> None: | ) -> None: | ||||
| with SCHEMA.create ('answers') as table: | with SCHEMA.create ('answers') as table: | ||||
| table.big_increments ('id') | table.big_increments ('id') | ||||
| table.big_integer ('query_id').nullable ().comment ('クエリ') | |||||
| table.big_integer ('query_id').unsigned ().nullable ().comment ('クエリ') | |||||
| table.integer ('character').comment ('キャラクタ区分') | table.integer ('character').comment ('キャラクタ区分') | ||||
| table.text ('content').comment ('回答内容') | table.text ('content').comment ('回答内容') | ||||
| table.integer ('answer_type').comment ('回答区分') | table.integer ('answer_type').comment ('回答区分') | ||||
| @@ -65,8 +65,8 @@ def create_query_answer_histories ( | |||||
| ) -> None: | ) -> None: | ||||
| with SCHEMA.create ('query_answer_histories') as table: | with SCHEMA.create ('query_answer_histories') as table: | ||||
| table.big_increments ('id') | table.big_increments ('id') | ||||
| table.big_integer ('query_id') | |||||
| table.big_integer ('answer_id') | |||||
| table.big_integer ('query_id').unsigned () | |||||
| table.big_integer ('answer_id').unsigned () | |||||
| table.unique (['query_id', 'answer_id']) | table.unique (['query_id', 'answer_id']) | ||||