summaryrefslogtreecommitdiff
path: root/db/migrate/20180503131624_create_remote_mirrors.rb
blob: a079c1b3328c18676910860ecbda8681909dadee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  # rubocop:disable Migration/AddLimitToStringColumns
  def up
    return if table_exists?(:remote_mirrors)

    create_table :remote_mirrors do |t|
      t.references :project, index: true, foreign_key: { on_delete: :cascade }
      t.string :url
      t.boolean :enabled, default: true
      t.string :update_status
      t.datetime :last_update_at
      t.datetime :last_successful_update_at
      t.datetime :last_update_started_at
      t.string :last_error
      t.boolean :only_protected_branches, default: false, null: false
      t.string :remote_name
      t.text :encrypted_credentials
      t.string :encrypted_credentials_iv
      t.string :encrypted_credentials_salt

      # rubocop:disable Migration/Timestamps
      t.timestamps null: false
    end
  end
  # rubocop:enable Migration/AddLimitToStringColumns

  def down
    # ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb will remove the table
  end
end