|
@@ -35,6 +35,7 @@ def create_queries ( |
|
|
table.integer ('model').comment ('GPT のモデル') |
|
|
table.integer ('model').comment ('GPT のモデル') |
|
|
table.datetime ('sent_at').comment ('送信日時') |
|
|
table.datetime ('sent_at').comment ('送信日時') |
|
|
table.boolean ('answered').default (False).comment ('回答済') |
|
|
table.boolean ('answered').default (False).comment ('回答済') |
|
|
|
|
|
table.foreign ('user_id').references ('user_id').on ('users').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_answers ( |
|
|
def create_answers ( |
|
@@ -47,6 +48,7 @@ def create_answers ( |
|
|
table.integer ('answer_type').comment ('回答区分') |
|
|
table.integer ('answer_type').comment ('回答区分') |
|
|
table.datetime ('sent_at').comment ('送信日時') |
|
|
table.datetime ('sent_at').comment ('送信日時') |
|
|
table.boolean ('answered').default (False).comment ('回答済') |
|
|
table.boolean ('answered').default (False).comment ('回答済') |
|
|
|
|
|
table.foreign ('query_id').references ('query_id').on ('queries').on_update ('cascade').on_delete ('restrict') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_users ( |
|
|
def create_users ( |
|
@@ -57,6 +59,7 @@ def create_users ( |
|
|
table.string ('code').comment ('ユーザ・コード(プラットフォーム依存)') |
|
|
table.string ('code').comment ('ユーザ・コード(プラットフォーム依存)') |
|
|
table.string ('name').comment ('ユーザ名(プラットフォーム内)') |
|
|
table.string ('name').comment ('ユーザ名(プラットフォーム内)') |
|
|
table.binary ('icon').nullable ().comment ('アイコン') |
|
|
table.binary ('icon').nullable ().comment ('アイコン') |
|
|
|
|
|
table.unique (['platform', 'code']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_query_answer_histories ( |
|
|
def create_query_answer_histories ( |
|
@@ -65,6 +68,9 @@ def create_query_answer_histories ( |
|
|
table.big_increments ('id') |
|
|
table.big_increments ('id') |
|
|
table.big_integer ('query_id') |
|
|
table.big_integer ('query_id') |
|
|
table.big_integer ('answer_id') |
|
|
table.big_integer ('answer_id') |
|
|
|
|
|
table.unique (['query_id', 'answer_id']) |
|
|
|
|
|
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') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DbConfig (TypedDict): |
|
|
class DbConfig (TypedDict): |
|
|