Commit 3be23cd8 authored by Thong Kuah's avatar Thong Kuah Committed by Mayra Cabrera

Autocorrect Ruby 2.7 keyword warnings in migrations

Autocorrect, then tidied up formatting
parent 1cf69f5d
...@@ -198,9 +198,9 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] ...@@ -198,9 +198,9 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
# rubocop:enable Migration/DropTable # rubocop:enable Migration/DropTable
end end
def add_column_with_default_if_not_exists(table, name, *args) def add_column_with_default_if_not_exists(table, name, type, **args)
unless column_exists?(table, name) unless column_exists?(table, name)
add_column_with_default(table, name, *args) # rubocop:disable Migration/AddColumnWithDefault add_column_with_default(table, name, type, **args) # rubocop:disable Migration/AddColumnWithDefault
end end
end end
......
...@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2] ...@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2]
t.integer :relative_position t.integer :relative_position
t.integer :start_event_identifier, null: false t.integer :start_event_identifier, null: false
t.integer :end_event_identifier, null: false t.integer :end_event_identifier, null: false
t.references(:project, {
t.references(:project,
null: false, null: false,
foreign_key: { to_table: :projects, on_delete: :cascade }, foreign_key: { to_table: :projects, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_project_id' } index: { name: INDEX_PREFIX + 'on_project_id' }
}) )
t.references(:start_event_label, { t.references(:start_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade }, foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_start_event_label_id' } index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
}) )
t.references(:end_event_label, { t.references(:end_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade }, foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_end_event_label_id' } index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
}) )
t.boolean :hidden, default: false, null: false t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, null: false t.boolean :custom, default: true, null: false
t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
......
...@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2] ...@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2]
t.integer :relative_position t.integer :relative_position
t.integer :start_event_identifier, null: false t.integer :start_event_identifier, null: false
t.integer :end_event_identifier, null: false t.integer :end_event_identifier, null: false
t.references(:group, {
t.references(:group,
null: false, null: false,
foreign_key: { to_table: :namespaces, on_delete: :cascade }, foreign_key: { to_table: :namespaces, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_group_id' } index: { name: INDEX_PREFIX + 'on_group_id' }
}) )
t.references(:start_event_label, { t.references(:start_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade }, foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_start_event_label_id' } index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
}) )
t.references(:end_event_label, { t.references(:end_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade }, foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_end_event_label_id' } index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
}) )
t.boolean :hidden, default: false, null: false t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, null: false t.boolean :custom, default: true, null: false
t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
......
...@@ -7,16 +7,15 @@ class CreateAnalyticsLanguageTrendRepositoryLanguages < ActiveRecord::Migration[ ...@@ -7,16 +7,15 @@ class CreateAnalyticsLanguageTrendRepositoryLanguages < ActiveRecord::Migration[
def change def change
create_table :analytics_language_trend_repository_languages, id: false do |t| create_table :analytics_language_trend_repository_languages, id: false do |t|
t.integer :file_count, null: false, default: 0 t.integer :file_count, null: false, default: 0
t.references :programming_language, {
t.references :programming_language,
null: false, null: false,
foreign_key: { on_delete: :cascade }, foreign_key: { on_delete: :cascade },
index: false index: false
} t.references :project,
t.references :project, {
null: false, null: false,
foreign_key: { on_delete: :cascade }, foreign_key: { on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_project_id' } index: { name: INDEX_PREFIX + 'on_project_id' }
}
t.integer :loc, null: false, default: 0 t.integer :loc, null: false, default: 0
t.integer :bytes, null: false, default: 0 t.integer :bytes, null: false, default: 0
# Storing percentage (with 2 decimal places), on 2 bytes. # Storing percentage (with 2 decimal places), on 2 bytes.
......
...@@ -13,11 +13,11 @@ class CreateAnalyticsCycleAnalyticsGroupValueStreams < ActiveRecord::Migration[6 ...@@ -13,11 +13,11 @@ class CreateAnalyticsCycleAnalyticsGroupValueStreams < ActiveRecord::Migration[6
with_lock_retries do with_lock_retries do
create_table :analytics_cycle_analytics_group_value_streams do |t| create_table :analytics_cycle_analytics_group_value_streams do |t|
t.timestamps_with_timezone t.timestamps_with_timezone
t.references(:group, { t.references(:group,
null: false, null: false,
index: false, index: false,
foreign_key: { to_table: :namespaces, on_delete: :cascade } foreign_key: { to_table: :namespaces, on_delete: :cascade }
}) )
t.text :name, null: false t.text :name, null: false
t.index [:group_id, :name], unique: true, name: INDEX_NAME t.index [:group_id, :name], unique: true, name: INDEX_NAME
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment