3 class CreateLanguages < ActiveRecord::Migration
5 create_table :languages, innodb_table do |t|
6 t.string :code, :limit => 5, :null => false
7 t.string :name, :null => false
8 t.boolean :translation_available, :null => false, :default => false
11 add_primary_key :languages, [:code]
13 Language.create(:code => 'en', :name => 'English', :translation_available => true)
15 add_foreign_key :users, [:locale], :languages, [:code]
16 add_foreign_key :diary_entries, [:language], :languages, [:code]
20 raise IrreversibleMigration.new