summaryrefslogtreecommitdiff
path: root/db/ci/migrate/20130114153451_change_schedule_invertal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/ci/migrate/20130114153451_change_schedule_invertal.rb')
-rw-r--r--db/ci/migrate/20130114153451_change_schedule_invertal.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/ci/migrate/20130114153451_change_schedule_invertal.rb b/db/ci/migrate/20130114153451_change_schedule_invertal.rb
new file mode 100644
index 00000000000..accf3eef473
--- /dev/null
+++ b/db/ci/migrate/20130114153451_change_schedule_invertal.rb
@@ -0,0 +1,25 @@
+class ChangeScheduleInvertal < ActiveRecord::Migration
+ def up
+ if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
+ connection.execute(%q{
+ ALTER TABLE projects
+ ALTER COLUMN polling_interval
+ TYPE integer USING CAST(polling_interval AS integer)
+ })
+ else
+ change_column :projects, :polling_interval, :integer, null: true
+ end
+ end
+
+ def down
+ if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
+ connection.execute(%q{
+ ALTER TABLE projects
+ ALTER COLUMN polling_interval
+ TYPE integer USING CAST(polling_interval AS varchar)
+ })
+ else
+ change_column :projects, :polling_interval, :string, null: true
+ end
+ end
+end