|  |  | @@ -0,0 +1,48 @@ | 
		
	
		
			
			|  |  |  | from eloquent.migrations import Migration | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | class CreateQueries (Migration): | 
		
	
		
			
			|  |  |  | """ | 
		
	
		
			
			|  |  |  | queries テーブルの作成 | 
		
	
		
			
			|  |  |  | """ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | def up ( | 
		
	
		
			
			|  |  |  | self, | 
		
	
		
			
			|  |  |  | ) -> None: | 
		
	
		
			
			|  |  |  | with self.schema.create ('queries') as table: | 
		
	
		
			
			|  |  |  | table.big_increments ('id') | 
		
	
		
			
			|  |  |  | table.big_integer ('user_id').nullable ().comment ('クエリ主') | 
		
	
		
			
			|  |  |  | table.integer ('target_character').comment ('クエリ先キャラクタ') | 
		
	
		
			
			|  |  |  | table.text ('content').comment ('クエリ内容') | 
		
	
		
			
			|  |  |  | table.binary ('attachment').nullable ().default (None).comment ('添附') | 
		
	
		
			
			|  |  |  | table.integer ('query_type').comment ('クエリ区分') | 
		
	
		
			
			|  |  |  | table.datetime ('sent_at', 6).comment ('送信日時') | 
		
	
		
			
			|  |  |  | table.boolean ('answered').default (False).comment ('回答済') | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | def down ( | 
		
	
		
			
			|  |  |  | self, | 
		
	
		
			
			|  |  |  | ) -> None: | 
		
	
		
			
			|  |  |  | self.schema.drop ('queries') | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | class CreateAnswers (Migration): | 
		
	
		
			
			|  |  |  | """ | 
		
	
		
			
			|  |  |  | answers テーブルの作成 | 
		
	
		
			
			|  |  |  | """ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | def up ( | 
		
	
		
			
			|  |  |  | self, | 
		
	
		
			
			|  |  |  | ) -> None: | 
		
	
		
			
			|  |  |  | with self.schema.create ('answers') as table: | 
		
	
		
			
			|  |  |  | table.big_increments ('id') | 
		
	
		
			
			|  |  |  | table.big_integer ('query_id').nullable ().comment ('クエリ') | 
		
	
		
			
			|  |  |  | table.integer ('character').comment ('キャラクタ区分') | 
		
	
		
			
			|  |  |  | table.text ('content').comment ('回答内容') | 
		
	
		
			
			|  |  |  | table.integer ('answer_type').comment ('回答区分') | 
		
	
		
			
			|  |  |  | table.datetime ('sent_at', 6).comment ('送信日時') | 
		
	
		
			
			|  |  |  | table.boolean ('answered').default (False).comment ('回答済') | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | def down ( | 
		
	
		
			
			|  |  |  | self, | 
		
	
		
			
			|  |  |  | ) -> None: | 
		
	
		
			
			|  |  |  | self.schema.drop ('answers') |