#3 answers.answered 移転
このコミットが含まれているのは:
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from config import CONFIG
|
||||
from ..config import CONFIG
|
||||
from eloquent import DatabaseManager, Schema
|
||||
|
||||
DB = DatabaseManager (CONFIG)
|
||||
@@ -0,0 +1,34 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ..config import CONFIG
|
||||
from eloquent import DatabaseManager, Schema
|
||||
|
||||
DB = DatabaseManager (CONFIG)
|
||||
SCHEMA = Schema (DB)
|
||||
|
||||
|
||||
def main (
|
||||
) -> None:
|
||||
create_answered_flags ()
|
||||
drop_answered_column_in_answers ()
|
||||
|
||||
|
||||
def create_answered_flags (
|
||||
) -> None:
|
||||
with SCHEMA.create ('answered_flags') as table:
|
||||
table.big_increments ('id')
|
||||
table.unsigned_big_integer ('answer_id').comment ('回答')
|
||||
table.integer ('platform').comment ('プラットフォーム区分')
|
||||
table.boolean ('answered').default (False).comment ('回答済')
|
||||
table.unique (['answered_id', 'platform'])
|
||||
table.foreign ('answered_id').references ('id').on ('answers').on_update ('cascade').on_delete ('cascade')
|
||||
|
||||
|
||||
def drop_answered_column_in_answers (
|
||||
) -> None:
|
||||
with SCHEMA.table ('answers') as table:
|
||||
table.drop_column ('answered')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main ()
|
||||
新しい課題から参照
ユーザをブロックする