10 changed files with 96 additions and 26 deletions
			
			
		| @ -0,0 +1,27 @@ | ||||
| module Ethnic | ||||
|   @@ethnic = { | ||||
|     "White: English/Scottish/Welsh/Northern Irish/British" => 1, | ||||
|     "White: Irish" => 2, | ||||
|     "White: Gypsy/Irish Traveller" => 18, | ||||
|     "White: Other" => 3, | ||||
|     "Mixed: White & Black Caribbean" => 4, | ||||
|     "Mixed: White & Black African" => 5, | ||||
|     "Mixed: White & Asian" => 6, | ||||
|     "Mixed: Other" => 7, | ||||
|     "Asian or Asian British: Indian" => 8, | ||||
|     "Asian or Asian British: Pakistani" => 9, | ||||
|     "Asian or Asian British: Bangladeshi" => 10, | ||||
|     "Asian or Asian British: Chinese" => 15, | ||||
|     "Asian or Asian British: Other" => 11, | ||||
|     "Black: Caribbean" => 12, | ||||
|     "Black: African" => 13, | ||||
|     "Black: Other" => 14, | ||||
|     "Other Ethnic Group: Arab" => 16, | ||||
|     "Other Ethnic Group: Other" => 19, | ||||
|     "Prefer not to say" => 17, | ||||
|   } | ||||
| 
 | ||||
|   def self.ethnic | ||||
|     @@ethnic | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,24 @@ | ||||
| module National | ||||
|   @@national = { | ||||
|     "UK national resident in UK" => 1, | ||||
|     "A current or former reserve in the UK Armed Forces (exc. National Service)" => 100, | ||||
|     "UK national returning from residence overseas" => 2, | ||||
|     "Czech Republic" => 3, | ||||
|     "Estonia" => 4, | ||||
|     "Hungary" => 5, | ||||
|     "Latvia" => 6, | ||||
|     "Lithuania" => 7, | ||||
|     "Poland" => 8, | ||||
|     "Slovakia" => 9, | ||||
|     "Bulgaria" => 14, | ||||
|     "Romania" => 15, | ||||
|     "Ireland" => 17, | ||||
|     "Other EU Economic Area (EEA country)" => 11, | ||||
|     "Any other country" => 12, | ||||
|     "Prefer not to say" => 13, | ||||
|   } | ||||
| 
 | ||||
|   def self.national | ||||
|     @@national | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,15 @@ | ||||
| class ChangeFieldTypes < ActiveRecord::Migration[6.1] | ||||
|   def up | ||||
|     change_table :case_logs, bulk: true do |t| | ||||
|       t.change :ethnic, "integer USING ethnic::integer" | ||||
|       t.change :national, "integer USING national::integer" | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def down | ||||
|     change_table :case_logs, bulk: true do |t| | ||||
|       t.change :ethnic, :string | ||||
|       t.change :national, :string | ||||
|     end | ||||
|   end | ||||
| end | ||||
					Loading…
					
					
				
		Reference in new issue