diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 18:07:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 18:07:53 +0300 |
commit | d7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch) | |
tree | f9fc9ea12e166aec6c4ffe476ba7a3566396b696 /db/migrate | |
parent | 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
7 files changed, 136 insertions, 0 deletions
diff --git a/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb b/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb new file mode 100644 index 00000000000..e8f7a693e99 --- /dev/null +++ b/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +class AddScannedResourcesCountToSecurityScan < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :security_scans, :scanned_resources_count, :integer + end + + def down + remove_column :security_scans, :scanned_resources_count + end +end diff --git a/db/migrate/20200326114443_create_jira_imports_table.rb b/db/migrate/20200326114443_create_jira_imports_table.rb new file mode 100644 index 00000000000..e114bd513f4 --- /dev/null +++ b/db/migrate/20200326114443_create_jira_imports_table.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CreateJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + create_table :jira_imports do |t| + t.integer :project_id, null: false, limit: 8 + t.integer :user_id, limit: 8 + t.integer :label_id, limit: 8 + t.timestamps_with_timezone + t.datetime_with_timezone :finished_at + t.integer :jira_project_xid, null: false, limit: 8 + t.integer :total_issue_count, null: false, default: 0, limit: 4 + t.integer :imported_issues_count, null: false, default: 0, limit: 4 + t.integer :failed_to_import_count, null: false, default: 0, limit: 4 + t.integer :status, limit: 2, null: false, default: 0 + t.string :jid, limit: 255 + t.string :jira_project_key, null: false, limit: 255 + t.string :jira_project_name, null: false, limit: 255 + end + + add_index :jira_imports, [:project_id, :jira_project_key], name: 'index_jira_imports_on_project_id_and_jira_project_key' + end +end diff --git a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..6410f530b30 --- /dev/null +++ b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectsFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :projects, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :projects + end + end +end diff --git a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..0956a8e814b --- /dev/null +++ b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUsersFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :users, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :users + end + end +end diff --git a/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb b/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb new file mode 100644 index 00000000000..5a26672f305 --- /dev/null +++ b/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddUsersFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :jira_imports, :user_id + end + + def down + remove_concurrent_index :jira_imports, :user_id + end +end diff --git a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..ead04100a96 --- /dev/null +++ b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddLabelsFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :labels, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :labels + end + end +end diff --git a/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb b/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb new file mode 100644 index 00000000000..d71c6f07989 --- /dev/null +++ b/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddLabelsFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :jira_imports, :label_id + end + + def down + remove_concurrent_index :jira_imports, :label_id + end +end |