summaryrefslogtreecommitdiff
path: root/db/migrate/20170830131015_swap_event_migration_tables.rb
blob: 5128d1b2fe7bffa658378c56fc618d2de33a96f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class SwapEventMigrationTables < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  def up
    rename_tables
  end

  def down
    rename_tables
  end

  def rename_tables
    rename_table :events, :events_old
    rename_table :events_for_migration, :events
    rename_table :events_old, :events_for_migration
  end
end