AI ニジカ綜合
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

  1. from eloquent.migrations import Migration
  2. class CreateQueries (Migration):
  3. """
  4. queries テーブルの作成
  5. """
  6. def up (
  7. self,
  8. ) -> None:
  9. with self.schema.create ('queries') as table:
  10. table.big_increments ('id')
  11. table.big_integer ('user_id').nullable ().comment ('クエリ主')
  12. table.integer ('target_character').comment ('クエリ先キャラクタ')
  13. table.text ('content').comment ('クエリ内容')
  14. table.binary ('attachment').nullable ().default (None).comment ('添附')
  15. table.integer ('query_type').comment ('クエリ区分')
  16. table.datetime ('sent_at', 6).comment ('送信日時')
  17. table.boolean ('answered').default (False).comment ('回答済')
  18. def down (
  19. self,
  20. ) -> None:
  21. self.schema.drop ('queries')
  22. class CreateAnswers (Migration):
  23. """
  24. answers テーブルの作成
  25. """
  26. def up (
  27. self,
  28. ) -> None:
  29. with self.schema.create ('answers') as table:
  30. table.big_increments ('id')
  31. table.big_integer ('query_id').nullable ().comment ('クエリ')
  32. table.integer ('character').comment ('キャラクタ区分')
  33. table.text ('content').comment ('回答内容')
  34. table.integer ('answer_type').comment ('回答区分')
  35. table.datetime ('sent_at', 6).comment ('送信日時')
  36. table.boolean ('answered').default (False).comment ('回答済')
  37. def down (
  38. self,
  39. ) -> None:
  40. self.schema.drop ('answers')