OSDN Git Service

ロゴ画像のURL取得他
authorhanabusa <hanabusa@kbmj.com>
Mon, 27 Jun 2011 01:49:10 +0000 (10:49 +0900)
committerhanabusa <hanabusa@kbmj.com>
Mon, 27 Jun 2011 01:49:10 +0000 (10:49 +0900)
db/migrate/20110624013509_add_resource_url_to_payments.rb [new file with mode: 0644]

diff --git a/db/migrate/20110624013509_add_resource_url_to_payments.rb b/db/migrate/20110624013509_add_resource_url_to_payments.rb
new file mode 100644 (file)
index 0000000..b352092
--- /dev/null
@@ -0,0 +1,17 @@
+class AddResourceUrlToPayments < ActiveRecord::Migration
+  def self.up
+    add_column :payments, :resource_url, :string, :comment => "ロゴ画像URL"
+    add_column :payments, :without_text, :boolean, :default => false, :comment => "テキスト非表示"
+    add_column :payments, :use_remote_resource, :boolean, :default => false, :comment => "リモートの画像使用"
+    Payment.find(:all).each do |p|
+      execute("UPDATE payments SET without_text = false WHERE id = #{p.id}")
+      execute("UPDATE payments SET use_remote_resource = false WHERE id = #{p.id}")
+    end
+  end
+
+  def self.down
+    remove_column :payments, :resource_url
+    remove_column :payments, :without_text
+    remove_column :payments, :use_remote_resource
+  end
+end