openstreetmap-website/db/migrate/034_create_languages.rb
Tom Hughes ded669bb4d Use a block to add the language record as rails seems to ignore any
attempt to set the primary key in the argument list of the create method.
2009-05-23 12:39:45 +00:00

27 lines
665 B
Ruby

require 'lib/migrate'
class CreateLanguages < ActiveRecord::Migration
def self.up
create_table :languages, innodb_table do |t|
t.string :code, :limit => 5, :null => false
t.string :name, :null => false
t.boolean :translation_available, :null => false, :default => false
end
add_primary_key :languages, [:code]
Language.create do |l|
l.code = 'en'
l.name = 'English'
l.translation_available = true
end
add_foreign_key :users, [:locale], :languages, [:code]
add_foreign_key :diary_entries, [:language], :languages, [:code]
end
def self.down
raise IrreversibleMigration.new
end
end