Class: Qa::Local::TablesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/qa/local/tables/tables_generator.rb

Instance Method Summary collapse

Instance Method Details

#migrationsObject



7
8
9
10
11
12
13
14
15
# File 'lib/generators/qa/local/tables/tables_generator.rb', line 7

def migrations
  generate "model qa/local_authority name:string:uniq"
  generate "model qa/local_authority_entry local_authority:references label:string uri:string:uniq"
  message = "Rails doesn't support functional indexes in migrations, so you'll have to add this manually:\n" \
"CREATE INDEX \"index_qa_local_authority_entries_on_lower_label\" ON \"qa_local_authority_entries\" (local_authority_id, lower(label))\n" \
"   OR on Sqlite: \n" \
"CREATE INDEX \"index_qa_local_authority_entries_on_lower_label\" ON \"qa_local_authority_entries\" (local_authority_id, label collate nocase)\n"
  say_status("info", message, :yellow)
end