0fc9f9d3e7
DB schema generated by a migration may look different in rails 4 and 5 (because rails 5 may use different default values). For this reason it's important to explicitly set for which rails version a migration was written for. See https://stackoverflow.com/questions/35929869/activerecordmigration-deprecation-warning-asks-for-rails-version-but-im-no/35930912#35930912
34 lines
957 B
Ruby
34 lines
957 B
Ruby
class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
DOWNTIME = false
|
|
|
|
disable_ddl_transaction!
|
|
|
|
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
|
|
|
|
def down
|
|
drop_table(:remote_mirrors) if table_exists?(:remote_mirrors)
|
|
end
|
|
end
|