]> git.openstreetmap.org Git - rails.git/blob - db/migrate/034_create_languages.rb
Fix formating of way and relation redaction messages as well
[rails.git] / db / migrate / 034_create_languages.rb
1 require 'migrate'
2
3 class CreateLanguages < ActiveRecord::Migration
4   def self.up
5     create_table :languages, innodb_table do |t|
6       t.string :code, :null => false
7       t.string :english_name, :null => false
8       t.string :native_name
9     end
10
11     add_primary_key :languages, [:code]
12
13     Language.load("#{Rails.root}/config/languages.yml")
14
15     add_foreign_key :users, [:locale], :languages, [:code]
16     add_foreign_key :diary_entries, [:language_code], :languages, [:code]    
17   end
18
19   def self.down
20     raise ActiveRecord::IrreversibleMigration
21   end
22 end