aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-03-25 15:20:59 +0000
committerSeb Bacon <seb.bacon@gmail.com>2011-03-25 15:20:59 +0000
commit2bb79f893805e972f6efe5cb7cfe90dd0efa4107 (patch)
tree47084acc8d48126b9e891bb50c217be43be27641 /db
parent22c25e42847d41924d43d31f3ef67be1ae4a155e (diff)
parent1fb57d66c22000d4164c033ffd9353aa9030255b (diff)
resolve merge conflicts
Diffstat (limited to 'db')
-rw-r--r--db/migrate/096_create_translation_tables.rb27
-rw-r--r--db/migrate/097_add_comment_locale.rb10
2 files changed, 37 insertions, 0 deletions
diff --git a/db/migrate/096_create_translation_tables.rb b/db/migrate/096_create_translation_tables.rb
new file mode 100644
index 000000000..9d7cc65ad
--- /dev/null
+++ b/db/migrate/096_create_translation_tables.rb
@@ -0,0 +1,27 @@
+class CreateTranslationTables < ActiveRecord::Migration
+ def self.up
+ fields = {:name => :text,
+ :short_name => :text,
+ :request_email => :text,
+ :url_name => :text,
+ :notes => :text,
+ :first_letter => :string,
+ :publication_scheme => :text}
+ PublicBody.create_translation_table!(fields)
+
+ # copy current values across to default locale
+ PublicBody.all.each do |publicbody|
+ publicbody.translated_attributes.each do |a, default|
+ value = publicbody.read_attribute(a)
+ unless value.nil?
+ publicbody.send(:"#{a}=", publicbody.read_attribute(a))
+ end
+ end
+ end
+ end
+
+
+ def self.down
+ PublicBody.drop_translation_table!
+ end
+end
diff --git a/db/migrate/097_add_comment_locale.rb b/db/migrate/097_add_comment_locale.rb
new file mode 100644
index 000000000..92ac7c4a5
--- /dev/null
+++ b/db/migrate/097_add_comment_locale.rb
@@ -0,0 +1,10 @@
+class AddCommentLocale < ActiveRecord::Migration
+ def self.up
+ add_column :comments, :locale, :text, :null => false, :default => ""
+ end
+
+ def self.down
+ remove_column :comments, :locale
+ end
+end
+