diff options
115 files changed, 568 insertions, 1188 deletions
diff --git a/app/assets/javascripts/ide/components/mr_file_icon.vue b/app/assets/javascripts/ide/components/mr_file_icon.vue index 8a440902dfc..179a589d1ac 100644 --- a/app/assets/javascripts/ide/components/mr_file_icon.vue +++ b/app/assets/javascripts/ide/components/mr_file_icon.vue @@ -16,8 +16,8 @@ export default { <icon name="git-merge" v-tooltip - title="__('Part of merge request changes')" - css-classes="ide-file-changed-icon" + :title="__('Part of merge request changes')" + css-classes="append-right-8" :size="12" /> </template> diff --git a/app/assets/stylesheets/framework/buttons.scss b/app/assets/stylesheets/framework/buttons.scss index f4f5926e198..cd9d60b96d3 100644 --- a/app/assets/stylesheets/framework/buttons.scss +++ b/app/assets/stylesheets/framework/buttons.scss @@ -106,10 +106,6 @@ @include btn-color($red-500, $red-600, $red-600, $red-700, $red-700, $red-800, $white-light); } -@mixin btn-gray { - @include btn-color($gray-light, $border-gray-normal, $gray-normal, $border-gray-normal, $gray-dark, $border-gray-dark, $gl-text-color); -} - @mixin btn-white { @include btn-color($white-light, $border-color, $white-normal, $border-white-normal, $white-dark, $border-gray-dark, $gl-text-color); } @@ -183,10 +179,6 @@ } } - &.btn-gray { - @include btn-gray; - } - &.btn-info, &.btn-primary, &.btn-register { diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index ea6467f0f11..dd0cb2c2613 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -205,7 +205,6 @@ .project-repo-buttons, .group-buttons { .btn { - @include btn-gray; padding: 3px 10px; &:last-child { @@ -294,7 +293,7 @@ } .count { - @include btn-gray; + @include btn-white; display: inline-block; background: $white-light; border-radius: 2px; diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 898e88344db..0b1b46944aa 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -87,7 +87,7 @@ class Projects::PipelinesController < Projects::ApplicationController end def failures - if @pipeline.statuses.latest.failed.present? + if @pipeline.failed_builds.present? render_show else redirect_to pipeline_path(@pipeline) diff --git a/app/models/concerns/reactive_caching.rb b/app/models/concerns/reactive_caching.rb index 2589215ad19..eef9caf1c8e 100644 --- a/app/models/concerns/reactive_caching.rb +++ b/app/models/concerns/reactive_caching.rb @@ -60,13 +60,16 @@ module ReactiveCaching end def with_reactive_cache(*args, &blk) - within_reactive_cache_lifetime(*args) do + bootstrap = !within_reactive_cache_lifetime?(*args) + Rails.cache.write(alive_reactive_cache_key(*args), true, expires_in: self.class.reactive_cache_lifetime) + + if bootstrap + ReactiveCachingWorker.perform_async(self.class, id, *args) + nil + else data = Rails.cache.read(full_reactive_cache_key(*args)) yield data if data.present? end - ensure - Rails.cache.write(alive_reactive_cache_key(*args), true, expires_in: self.class.reactive_cache_lifetime) - ReactiveCachingWorker.perform_async(self.class, id, *args) end def clear_reactive_cache!(*args) @@ -75,7 +78,7 @@ module ReactiveCaching def exclusively_update_reactive_cache!(*args) locking_reactive_cache(*args) do - within_reactive_cache_lifetime(*args) do + if within_reactive_cache_lifetime?(*args) enqueuing_update(*args) do value = calculate_reactive_cache(*args) Rails.cache.write(full_reactive_cache_key(*args), value) @@ -105,8 +108,8 @@ module ReactiveCaching Gitlab::ExclusiveLease.cancel(full_reactive_cache_key(*args), uuid) end - def within_reactive_cache_lifetime(*args) - yield if Rails.cache.read(alive_reactive_cache_key(*args)) + def within_reactive_cache_lifetime?(*args) + !!Rails.cache.read(alive_reactive_cache_key(*args)) end def enqueuing_update(*args) diff --git a/app/models/project.rb b/app/models/project.rb index f6ac1802846..32d34f5e9b8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -661,9 +661,15 @@ class Project < ActiveRecord::Base return if !force && (self[:import_status] == 'none' || self[:import_status].nil?) return unless import_state.nil? - create_import_state(import_state_args) + if persisted? + create_import_state(import_state_args) - update_column(:import_status, 'none') + update_column(:import_status, 'none') + else + build_import_state(import_state_args) + + self[:import_status] = 'none' + end end def import_schedule diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 099b4720fb6..cc2bce9862d 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -1,11 +1,21 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated + include Gitlab::Utils::StrongMemoize + FAILURE_REASONS = { config_error: 'CI/CD YAML configuration error!' }.freeze presents :pipeline + def failed_builds + return [] unless can?(current_user, :read_build, pipeline) + + strong_memoize(:failed_builds) do + pipeline.builds.latest.failed + end + end + def failure_reason return unless pipeline.failure_reason? diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml index 29b23ae2e52..1c5b4aecabb 100644 --- a/app/views/help/_shortcuts.html.haml +++ b/app/views/help/_shortcuts.html.haml @@ -1,5 +1,5 @@ #modal-shortcuts.modal{ tabindex: -1 } - .modal-dialog + .modal-dialog.modal-lg .modal-content .modal-header %a.close{ href: "#", "data-dismiss" => "modal" } × diff --git a/app/views/help/ui.html.haml b/app/views/help/ui.html.haml index ce09b44fbb2..7908a04c2eb 100644 --- a/app/views/help/ui.html.haml +++ b/app/views/help/ui.html.haml @@ -74,10 +74,10 @@ = lorem .cover-controls - = link_to '#', class: 'btn btn-gray' do + = link_to '#', class: 'btn btn-default' do = icon('pencil') - = link_to '#', class: 'btn btn-gray' do + = link_to '#', class: 'btn btn-default' do = icon('rss') %h2#lists Lists @@ -206,7 +206,6 @@ .example %button.btn.btn-default{ :type => "button" } Default - %button.btn.btn-gray{ :type => "button" } Gray %button.btn.btn-primary{ :type => "button" } Primary %button.btn.btn-success{ :type => "button" } Success %button.btn.btn-info{ :type => "button" } Info diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index 218e7338c83..4dbf95be357 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -1,5 +1,3 @@ -- failed_builds = @pipeline.statuses.latest.failed - .tabs-holder %ul.pipelines-tabs.nav-links.no-top.no-bottom.mobile-separator %li.js-pipeline-tab-link @@ -9,11 +7,11 @@ = link_to builds_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-builds', action: 'builds', toggle: 'tab' }, class: 'builds-tab' do = _("Jobs") %span.badge.js-builds-counter= pipeline.total_size - - if failed_builds.present? + - if @pipeline.failed_builds.present? %li.js-failures-tab-link = link_to failures_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-failures', action: 'failures', toggle: 'tab' }, class: 'failures-tab' do = _("Failed Jobs") - %span.badge.js-failures-counter= failed_builds.count + %span.badge.js-failures-counter= @pipeline.failed_builds.count .tab-content #js-tab-pipeline.tab-pane @@ -43,9 +41,10 @@ %th Coverage %th = render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage - - if failed_builds.present? + + - if @pipeline.failed_builds.present? #js-tab-failures.build-failures.tab-pane - - failed_builds.each_with_index do |build, index| + - @pipeline.failed_builds.each_with_index do |build, index| .build-state %span.ci-status-icon-failed= custom_icon('icon_status_failed') %span.stage diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index d35ddf3eb39..fb909237b9a 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -12,7 +12,7 @@ .cover-block.user-cover-block.top-area .cover-controls - if @user == current_user - = link_to profile_path, class: 'btn btn-gray has-tooltip', title: 'Edit profile', 'aria-label': 'Edit profile' do + = link_to profile_path, class: 'btn btn-default has-tooltip', title: 'Edit profile', 'aria-label': 'Edit profile' do = icon('pencil') - elsif current_user - if @user.abuse_report @@ -20,13 +20,13 @@ data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } } = icon('exclamation-circle') - else - = link_to new_abuse_report_path(user_id: @user.id, ref_url: request.referrer), class: 'btn btn-gray', + = link_to new_abuse_report_path(user_id: @user.id, ref_url: request.referrer), class: 'btn', title: 'Report abuse', data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } do = icon('exclamation-circle') - = link_to user_path(@user, rss_url_options), class: 'btn btn-gray has-tooltip', title: 'Subscribe', 'aria-label': 'Subscribe' do + = link_to user_path(@user, rss_url_options), class: 'btn btn-default has-tooltip', title: 'Subscribe', 'aria-label': 'Subscribe' do = icon('rss') - if current_user && current_user.admin? - = link_to [:admin, @user], class: 'btn btn-gray', title: 'View user in admin area', + = link_to [:admin, @user], class: 'btn btn-default', title: 'View user in admin area', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = icon('users') diff --git a/changelogs/unreleased/44319-remove-gray-buttons.yml b/changelogs/unreleased/44319-remove-gray-buttons.yml new file mode 100644 index 00000000000..9803dde8493 --- /dev/null +++ b/changelogs/unreleased/44319-remove-gray-buttons.yml @@ -0,0 +1,5 @@ +--- +title: Remove gray button styles +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/feature-expose-runner-ip-to-api.yml b/changelogs/unreleased/feature-expose-runner-ip-to-api.yml new file mode 100644 index 00000000000..e755cf5f2d4 --- /dev/null +++ b/changelogs/unreleased/feature-expose-runner-ip-to-api.yml @@ -0,0 +1,5 @@ +--- +title: Expose runner ip address to runners API +merge_request: 18799 +author: Lars Greiss +type: changed diff --git a/changelogs/unreleased/fix-gb-add-pipeline-builds-foreign-key.yml b/changelogs/unreleased/fix-gb-add-pipeline-builds-foreign-key.yml new file mode 100644 index 00000000000..bded7bb7cc4 --- /dev/null +++ b/changelogs/unreleased/fix-gb-add-pipeline-builds-foreign-key.yml @@ -0,0 +1,5 @@ +--- +title: Add database foreign key constraint between pipelines and build +merge_request: 18822 +author: +type: fixed diff --git a/changelogs/unreleased/fix-reactive-cache-retry-rate.yml b/changelogs/unreleased/fix-reactive-cache-retry-rate.yml new file mode 100644 index 00000000000..044e7fe39c0 --- /dev/null +++ b/changelogs/unreleased/fix-reactive-cache-retry-rate.yml @@ -0,0 +1,5 @@ +--- +title: Update commit status from external CI services less aggressively +merge_request: 18802 +author: +type: fixed diff --git a/changelogs/unreleased/fix-shorcut-modal.yml b/changelogs/unreleased/fix-shorcut-modal.yml new file mode 100644 index 00000000000..796a1523a61 --- /dev/null +++ b/changelogs/unreleased/fix-shorcut-modal.yml @@ -0,0 +1,5 @@ +--- +title: Fix modal width of shorcuts help page +merge_request: 18766 +author: Lars Greiss +type: fixed diff --git a/db/migrate/20121220064453_init_schema.rb b/db/migrate/20121220064453_init_schema.rb deleted file mode 100644 index f93dc92b70f..00000000000 --- a/db/migrate/20121220064453_init_schema.rb +++ /dev/null @@ -1,307 +0,0 @@ -# rubocop:disable all -class InitSchema < ActiveRecord::Migration - def up - - create_table "events", force: true do |t| - t.string "target_type" - t.integer "target_id" - t.string "title" - t.text "data" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "action" - t.integer "author_id" - end - - add_index "events", ["action"], name: "index_events_on_action", using: :btree - add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree - add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree - add_index "events", ["project_id"], name: "index_events_on_project_id", using: :btree - add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree - add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree - - create_table "issues", force: true do |t| - t.string "title" - t.integer "assignee_id" - t.integer "author_id" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "closed", default: false, null: false - t.integer "position", default: 0 - t.string "branch_name" - t.text "description" - t.integer "milestone_id" - end - - add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree - add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree - add_index "issues", ["closed"], name: "index_issues_on_closed", using: :btree - add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree - add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree - add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree - add_index "issues", ["title"], name: "index_issues_on_title", using: :btree - - create_table "keys", force: true do |t| - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "key" - t.string "title" - t.string "identifier" - t.integer "project_id" - end - - add_index "keys", ["identifier"], name: "index_keys_on_identifier", using: :btree - add_index "keys", ["project_id"], name: "index_keys_on_project_id", using: :btree - add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree - - create_table "merge_requests", force: true do |t| - t.string "target_branch", null: false - t.string "source_branch", null: false - t.integer "project_id", null: false - t.integer "author_id" - t.integer "assignee_id" - t.string "title" - t.boolean "closed", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" - t.text "st_commits" - t.text "st_diffs" - t.boolean "merged", default: false, null: false - t.integer "state", default: 1, null: false - t.integer "milestone_id" - end - - add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree - add_index "merge_requests", ["author_id"], name: "index_merge_requests_on_author_id", using: :btree - add_index "merge_requests", ["closed"], name: "index_merge_requests_on_closed", using: :btree - add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree - add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree - add_index "merge_requests", ["project_id"], name: "index_merge_requests_on_project_id", using: :btree - add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree - add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree - add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree - - create_table "milestones", force: true do |t| - t.string "title", null: false - t.integer "project_id", null: false - t.text "description" - t.date "due_date" - t.boolean "closed", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree - add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree - - create_table "namespaces", force: true do |t| - t.string "name", null: false - t.string "path", null: false - t.integer "owner_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.string "type" - end - - add_index "namespaces", ["name"], name: "index_namespaces_on_name", using: :btree - add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree - add_index "namespaces", ["path"], name: "index_namespaces_on_path", using: :btree - add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree - - create_table "notes", force: true do |t| - t.text "note" - t.string "noteable_type" - t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "project_id" - t.string "attachment" - t.string "line_code" - t.string "commit_id" - t.integer "noteable_id" - end - - add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree - add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree - add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree - add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree - add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree - - create_table "projects", force: true do |t| - t.string "name" - t.string "path" - t.text "description" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "private_flag", default: true, null: false - t.integer "owner_id" - t.string "default_branch" - t.boolean "issues_enabled", default: true, null: false - t.boolean "wall_enabled", default: true, null: false - t.boolean "merge_requests_enabled", default: true, null: false - t.boolean "wiki_enabled", default: true, null: false - t.integer "namespace_id" - end - - add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree - add_index "projects", ["owner_id"], name: "index_projects_on_owner_id", using: :btree - - create_table "protected_branches", force: true do |t| - t.integer "project_id", null: false - t.string "name", null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "services", force: true do |t| - t.string "type" - t.string "title" - t.string "token" - t.integer "project_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "active", default: false, null: false - t.string "project_url" - end - - add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree - - create_table "snippets", force: true do |t| - t.string "title" - t.text "content" - t.integer "author_id", null: false - t.integer "project_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_name" - t.datetime "expires_at" - end - - add_index "snippets", ["created_at"], name: "index_snippets_on_created_at", using: :btree - add_index "snippets", ["expires_at"], name: "index_snippets_on_expires_at", using: :btree - add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree - - create_table "taggings", force: true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context" - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - - create_table "tags", force: true do |t| - t.string "name" - end - - create_table "user_team_project_relationships", force: true do |t| - t.integer "project_id" - t.integer "user_team_id" - t.integer "greatest_access" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "user_team_user_relationships", force: true do |t| - t.integer "user_id" - t.integer "user_team_id" - t.boolean "group_admin" - t.integer "permission" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "user_teams", force: true do |t| - t.string "name" - t.string "path" - t.integer "owner_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", force: true do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.datetime "created_at" - t.datetime "updated_at" - t.string "name" - t.boolean "admin", default: false, null: false - t.integer "projects_limit", default: 10 - t.string "skype", default: "", null: false - t.string "linkedin", default: "", null: false - t.string "twitter", default: "", null: false - t.string "authentication_token" - t.boolean "dark_scheme", default: false, null: false - t.integer "theme_id", default: 1, null: false - t.string "bio" - t.boolean "blocked", default: false, null: false - t.integer "failed_attempts", default: 0 - t.datetime "locked_at" - t.string "extern_uid" - t.string "provider" - t.string "username" - end - - add_index "users", ["admin"], name: "index_users_on_admin", using: :btree - add_index "users", ["blocked"], name: "index_users_on_blocked", using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree - add_index "users", ["name"], name: "index_users_on_name", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - add_index "users", ["username"], name: "index_users_on_username", using: :btree - - create_table "users_projects", force: true do |t| - t.integer "user_id", null: false - t.integer "project_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "project_access", default: 0, null: false - end - - add_index "users_projects", ["project_access"], name: "index_users_projects_on_project_access", using: :btree - add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree - add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree - - create_table "web_hooks", force: true do |t| - t.string "url" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type", default: "ProjectHook" - t.integer "service_id" - end - - create_table "wikis", force: true do |t| - t.string "title" - t.text "content" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "slug" - t.integer "user_id" - end - - add_index "wikis", ["project_id"], name: "index_wikis_on_project_id", using: :btree - add_index "wikis", ["slug"], name: "index_wikis_on_slug", using: :btree - - end - - def down - raise "Can not revert initial migration" - end -end diff --git a/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb b/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb deleted file mode 100644 index 84fd2060770..00000000000 --- a/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class RenameOwnerToCreatorForProject < ActiveRecord::Migration - def change - rename_column :projects, :owner_id, :creator_id - end -end diff --git a/db/migrate/20130110172407_add_public_to_project.rb b/db/migrate/20130110172407_add_public_to_project.rb deleted file mode 100644 index 4362aadcc1d..00000000000 --- a/db/migrate/20130110172407_add_public_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddPublicToProject < ActiveRecord::Migration - def change - add_column :projects, :public, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20130123114545_add_issues_tracker_to_project.rb b/db/migrate/20130123114545_add_issues_tracker_to_project.rb deleted file mode 100644 index ba8c50b53e2..00000000000 --- a/db/migrate/20130123114545_add_issues_tracker_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddIssuesTrackerToProject < ActiveRecord::Migration - def change - add_column :projects, :issues_tracker, :string, default: :gitlab, null: false - end -end diff --git a/db/migrate/20130125090214_add_user_permissions.rb b/db/migrate/20130125090214_add_user_permissions.rb deleted file mode 100644 index 1350eadb60e..00000000000 --- a/db/migrate/20130125090214_add_user_permissions.rb +++ /dev/null @@ -1,12 +0,0 @@ -# rubocop:disable all -class AddUserPermissions < ActiveRecord::Migration - def up - add_column :users, :can_create_group, :boolean, default: true, null: false - add_column :users, :can_create_team, :boolean, default: true, null: false - end - - def down - remove_column :users, :can_create_group - remove_column :users, :can_create_team - end -end diff --git a/db/migrate/20130131070232_remove_private_flag_from_project.rb b/db/migrate/20130131070232_remove_private_flag_from_project.rb deleted file mode 100644 index f0273ba448e..00000000000 --- a/db/migrate/20130131070232_remove_private_flag_from_project.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemovePrivateFlagFromProject < ActiveRecord::Migration - def up - remove_column :projects, :private_flag - end - - def down - add_column :projects, :private_flag, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20130206084024_add_description_to_namsespace.rb b/db/migrate/20130206084024_add_description_to_namsespace.rb deleted file mode 100644 index 62676ce8914..00000000000 --- a/db/migrate/20130206084024_add_description_to_namsespace.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddDescriptionToNamsespace < ActiveRecord::Migration - def change - add_column :namespaces, :description, :string, default: '', null: false - end -end diff --git a/db/migrate/20130207104426_add_description_to_teams.rb b/db/migrate/20130207104426_add_description_to_teams.rb deleted file mode 100644 index bd9a4767b69..00000000000 --- a/db/migrate/20130207104426_add_description_to_teams.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddDescriptionToTeams < ActiveRecord::Migration - def change - add_column :user_teams, :description, :string, default: '', null: false - end -end diff --git a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb b/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb deleted file mode 100644 index 56b01cbf892..00000000000 --- a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddIssuesTrackerIdToProject < ActiveRecord::Migration - def change - add_column :projects, :issues_tracker_id, :string - end -end diff --git a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb b/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb deleted file mode 100644 index 4722cc13d4b..00000000000 --- a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration - def change - rename_column :merge_requests, :state, :merge_status - end -end diff --git a/db/migrate/20130218140952_add_state_to_issue.rb b/db/migrate/20130218140952_add_state_to_issue.rb deleted file mode 100644 index 3a5e978a182..00000000000 --- a/db/migrate/20130218140952_add_state_to_issue.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddStateToIssue < ActiveRecord::Migration - def change - add_column :issues, :state, :string - end -end diff --git a/db/migrate/20130218141038_add_state_to_merge_request.rb b/db/migrate/20130218141038_add_state_to_merge_request.rb deleted file mode 100644 index e0180c755e2..00000000000 --- a/db/migrate/20130218141038_add_state_to_merge_request.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddStateToMergeRequest < ActiveRecord::Migration - def change - add_column :merge_requests, :state, :string - end -end diff --git a/db/migrate/20130218141117_add_state_to_milestone.rb b/db/migrate/20130218141117_add_state_to_milestone.rb deleted file mode 100644 index 5f71608692c..00000000000 --- a/db/migrate/20130218141117_add_state_to_milestone.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddStateToMilestone < ActiveRecord::Migration - def change - add_column :milestones, :state, :string - end -end diff --git a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb deleted file mode 100644 index 67a0d3b53eb..00000000000 --- a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb +++ /dev/null @@ -1,19 +0,0 @@ -# rubocop:disable all -class ConvertClosedToStateInIssue < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def up - execute "UPDATE #{table_name} SET state = 'closed' WHERE closed = #{true_value}" - execute "UPDATE #{table_name} SET state = 'opened' WHERE closed = #{false_value}" - end - - def down - execute "UPDATE #{table_name} SET closed = #{true_value} WHERE state = 'closed'" - end - - private - - def table_name - Issue.table_name - end -end diff --git a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb b/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb deleted file mode 100644 index 307fc6a023d..00000000000 --- a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb +++ /dev/null @@ -1,21 +0,0 @@ -# rubocop:disable all -class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def up - execute "UPDATE #{table_name} SET state = 'merged' WHERE closed = #{true_value} AND merged = #{true_value}" - execute "UPDATE #{table_name} SET state = 'closed' WHERE closed = #{true_value} AND merged = #{false_value}" - execute "UPDATE #{table_name} SET state = 'opened' WHERE closed = #{false_value}" - end - - def down - execute "UPDATE #{table_name} SET closed = #{true_value} WHERE state = 'closed'" - execute "UPDATE #{table_name} SET closed = #{true_value}, merged = #{true_value} WHERE state = 'merged'" - end - - private - - def table_name - MergeRequest.table_name - end -end diff --git a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb b/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb deleted file mode 100644 index d12703cf3b2..00000000000 --- a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb +++ /dev/null @@ -1,19 +0,0 @@ -# rubocop:disable all -class ConvertClosedToStateInMilestone < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def up - execute "UPDATE #{table_name} SET state = 'closed' WHERE closed = #{true_value}" - execute "UPDATE #{table_name} SET state = 'active' WHERE closed = #{false_value}" - end - - def down - execute "UPDATE #{table_name} SET closed = #{true_value} WHERE state = 'cloesd'" - end - - private - - def table_name - Milestone.table_name - end -end diff --git a/db/migrate/20130218141444_remove_merged_from_merge_request.rb b/db/migrate/20130218141444_remove_merged_from_merge_request.rb deleted file mode 100644 index afa5137061e..00000000000 --- a/db/migrate/20130218141444_remove_merged_from_merge_request.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveMergedFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :merged - end - - def down - add_column :merge_requests, :merged, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20130218141507_remove_closed_from_issue.rb b/db/migrate/20130218141507_remove_closed_from_issue.rb deleted file mode 100644 index f250288bc3b..00000000000 --- a/db/migrate/20130218141507_remove_closed_from_issue.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveClosedFromIssue < ActiveRecord::Migration - def up - remove_column :issues, :closed - end - - def down - add_column :issues, :closed, :boolean - end -end diff --git a/db/migrate/20130218141536_remove_closed_from_merge_request.rb b/db/migrate/20130218141536_remove_closed_from_merge_request.rb deleted file mode 100644 index efa12e32636..00000000000 --- a/db/migrate/20130218141536_remove_closed_from_merge_request.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveClosedFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :closed - end - - def down - add_column :merge_requests, :closed, :boolean - end -end diff --git a/db/migrate/20130218141554_remove_closed_from_milestone.rb b/db/migrate/20130218141554_remove_closed_from_milestone.rb deleted file mode 100644 index 75ac14e43be..00000000000 --- a/db/migrate/20130218141554_remove_closed_from_milestone.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveClosedFromMilestone < ActiveRecord::Migration - def up - remove_column :milestones, :closed - end - - def down - add_column :milestones, :closed, :boolean - end -end diff --git a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb deleted file mode 100644 index 97615e47c89..00000000000 --- a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration - def change - add_column :merge_requests, :new_merge_status, :string - end -end diff --git a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb deleted file mode 100644 index 3b8c3686c55..00000000000 --- a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb +++ /dev/null @@ -1,20 +0,0 @@ -# rubocop:disable all -class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration - def up - execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1" - execute "UPDATE #{table_name} SET new_merge_status = 'can_be_merged' WHERE merge_status = 2" - execute "UPDATE #{table_name} SET new_merge_status = 'cannot_be_merged' WHERE merge_status = 3" - end - - def down - execute "UPDATE #{table_name} SET merge_status = 1 WHERE new_merge_status = 'unchecked'" - execute "UPDATE #{table_name} SET merge_status = 2 WHERE new_merge_status = 'can_be_merged'" - execute "UPDATE #{table_name} SET merge_status = 3 WHERE new_merge_status = 'cannot_be_merged'" - end - - private - - def table_name - MergeRequest.table_name - end -end diff --git a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb deleted file mode 100644 index bd25ffbfc99..00000000000 --- a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :merge_status - end - - def down - add_column :merge_requests, :merge_status, :integer - end -end diff --git a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb deleted file mode 100644 index f0595720a39..00000000000 --- a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration - def change - rename_column :merge_requests, :new_merge_status, :merge_status - end -end diff --git a/db/migrate/20130304104623_add_state_to_user.rb b/db/migrate/20130304104623_add_state_to_user.rb deleted file mode 100644 index 4456d022e3f..00000000000 --- a/db/migrate/20130304104623_add_state_to_user.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddStateToUser < ActiveRecord::Migration - def change - add_column :users, :state, :string - end -end diff --git a/db/migrate/20130304104740_convert_blocked_to_state.rb b/db/migrate/20130304104740_convert_blocked_to_state.rb deleted file mode 100644 index 9afd1093645..00000000000 --- a/db/migrate/20130304104740_convert_blocked_to_state.rb +++ /dev/null @@ -1,15 +0,0 @@ -# rubocop:disable all -class ConvertBlockedToState < ActiveRecord::Migration - def up - User.transaction do - User.where(blocked: true).update_all(state: :blocked) - User.where(blocked: false).update_all(state: :active) - end - end - - def down - User.transaction do - User.where(state: :blocked).update_all(blocked: :true) - end - end -end diff --git a/db/migrate/20130304105317_remove_blocked_from_user.rb b/db/migrate/20130304105317_remove_blocked_from_user.rb deleted file mode 100644 index 8f5b2c59b43..00000000000 --- a/db/migrate/20130304105317_remove_blocked_from_user.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveBlockedFromUser < ActiveRecord::Migration - def up - remove_column :users, :blocked - end - - def down - add_column :users, :blocked, :boolean - end -end diff --git a/db/migrate/20130315124931_user_color_scheme.rb b/db/migrate/20130315124931_user_color_scheme.rb deleted file mode 100644 index 09af928fde7..00000000000 --- a/db/migrate/20130315124931_user_color_scheme.rb +++ /dev/null @@ -1,15 +0,0 @@ -# rubocop:disable all -class UserColorScheme < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def up - add_column :users, :color_scheme_id, :integer, null: false, default: 1 - execute("UPDATE users SET color_scheme_id = 2 WHERE dark_scheme = #{true_value}") - remove_column :users, :dark_scheme - end - - def down - add_column :users, :dark_scheme, :boolean, null: false, default: false - remove_column :users, :color_scheme_id - end -end diff --git a/db/migrate/20130318212250_add_snippets_to_features.rb b/db/migrate/20130318212250_add_snippets_to_features.rb deleted file mode 100644 index 9860b85f504..00000000000 --- a/db/migrate/20130318212250_add_snippets_to_features.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddSnippetsToFeatures < ActiveRecord::Migration - def change - add_column :projects, :snippets_enabled, :boolean, null: false, default: true - end -end diff --git a/db/migrate/20130319214458_create_forked_project_links.rb b/db/migrate/20130319214458_create_forked_project_links.rb deleted file mode 100644 index 065a5e08243..00000000000 --- a/db/migrate/20130319214458_create_forked_project_links.rb +++ /dev/null @@ -1,14 +0,0 @@ -# rubocop:disable all -class CreateForkedProjectLinks < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :forked_project_links do |t| - t.integer :forked_to_project_id, null: false - t.integer :forked_from_project_id, null: false - - t.timestamps null: true - end - add_index :forked_project_links, :forked_to_project_id, unique: true - end -end diff --git a/db/migrate/20130323174317_add_private_to_snippets.rb b/db/migrate/20130323174317_add_private_to_snippets.rb deleted file mode 100644 index 376f4618d41..00000000000 --- a/db/migrate/20130323174317_add_private_to_snippets.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddPrivateToSnippets < ActiveRecord::Migration - def change - add_column :snippets, :private, :boolean, null: false, default: true - end -end diff --git a/db/migrate/20130324151736_add_type_to_snippets.rb b/db/migrate/20130324151736_add_type_to_snippets.rb deleted file mode 100644 index 097cb9bc7cb..00000000000 --- a/db/migrate/20130324151736_add_type_to_snippets.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddTypeToSnippets < ActiveRecord::Migration - def change - add_column :snippets, :type, :string - end -end diff --git a/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb b/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb deleted file mode 100644 index 9256e62086e..00000000000 --- a/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class ChangeProjectIdToNullInSnipepts < ActiveRecord::Migration - def up - change_column :snippets, :project_id, :integer, :null => true - end - - def down - change_column :snippets, :project_id, :integer, :null => false - end -end diff --git a/db/migrate/20130324203535_add_type_value_for_snippets.rb b/db/migrate/20130324203535_add_type_value_for_snippets.rb deleted file mode 100644 index 6e910fd74c7..00000000000 --- a/db/migrate/20130324203535_add_type_value_for_snippets.rb +++ /dev/null @@ -1,9 +0,0 @@ -# rubocop:disable all -class AddTypeValueForSnippets < ActiveRecord::Migration - def up - Snippet.where("project_id IS NOT NULL").update_all(type: 'ProjectSnippet') - end - - def down - end -end diff --git a/db/migrate/20130325173941_add_notification_level_to_user.rb b/db/migrate/20130325173941_add_notification_level_to_user.rb deleted file mode 100644 index 1dc58d4bcc8..00000000000 --- a/db/migrate/20130325173941_add_notification_level_to_user.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddNotificationLevelToUser < ActiveRecord::Migration - def change - add_column :users, :notification_level, :integer, null: false, default: 1 - end -end diff --git a/db/migrate/20130326142630_add_index_to_users_authentication_token.rb b/db/migrate/20130326142630_add_index_to_users_authentication_token.rb deleted file mode 100644 index 0592181927e..00000000000 --- a/db/migrate/20130326142630_add_index_to_users_authentication_token.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddIndexToUsersAuthenticationToken < ActiveRecord::Migration - def change - add_index :users, :authentication_token, unique: true - end -end diff --git a/db/migrate/20130403003950_add_last_activity_column_into_project.rb b/db/migrate/20130403003950_add_last_activity_column_into_project.rb deleted file mode 100644 index 04a01612c6f..00000000000 --- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb +++ /dev/null @@ -1,24 +0,0 @@ -# rubocop:disable all -class AddLastActivityColumnIntoProject < ActiveRecord::Migration - def up - add_column :projects, :last_activity_at, :datetime - add_index :projects, :last_activity_at - - select_all('SELECT id, updated_at FROM projects').each do |project| - project_id = project['id'] - update_date = project['updated_at'] - event = select_one("SELECT created_at FROM events WHERE project_id = #{project_id} ORDER BY created_at DESC LIMIT 1") - - if event && event['created_at'] - update_date = event['created_at'] - end - - execute("UPDATE projects SET last_activity_at = '#{update_date}' WHERE id = #{project_id}") - end - end - - def down - remove_index :projects, :last_activity_at - remove_column :projects, :last_activity_at - end -end diff --git a/db/migrate/20130404164628_add_notification_level_to_user_project.rb b/db/migrate/20130404164628_add_notification_level_to_user_project.rb deleted file mode 100644 index 1e072d9c6e1..00000000000 --- a/db/migrate/20130404164628_add_notification_level_to_user_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddNotificationLevelToUserProject < ActiveRecord::Migration - def change - add_column :users_projects, :notification_level, :integer, null: false, default: 3 - end -end diff --git a/db/migrate/20130410175022_remove_wiki_table.rb b/db/migrate/20130410175022_remove_wiki_table.rb deleted file mode 100644 index 5885b1cc375..00000000000 --- a/db/migrate/20130410175022_remove_wiki_table.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveWikiTable < ActiveRecord::Migration - def up - drop_table :wikis - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end diff --git a/db/migrate/20130419190306_allow_merges_for_forks.rb b/db/migrate/20130419190306_allow_merges_for_forks.rb deleted file mode 100644 index ec953986c6a..00000000000 --- a/db/migrate/20130419190306_allow_merges_for_forks.rb +++ /dev/null @@ -1,20 +0,0 @@ -# rubocop:disable all -class AllowMergesForForks < ActiveRecord::Migration - def self.up - add_column :merge_requests, :target_project_id, :integer, :null => true - execute "UPDATE #{table_name} SET target_project_id = project_id" - change_column :merge_requests, :target_project_id, :integer, :null => false - rename_column :merge_requests, :project_id, :source_project_id - end - - def self.down - remove_column :merge_requests, :target_project_id - rename_column :merge_requests, :source_project_id,:project_id - end - - private - - def table_name - MergeRequest.table_name - end -end diff --git a/db/migrate/20130506085413_add_type_to_key.rb b/db/migrate/20130506085413_add_type_to_key.rb deleted file mode 100644 index c9f1ee4e389..00000000000 --- a/db/migrate/20130506085413_add_type_to_key.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddTypeToKey < ActiveRecord::Migration - def change - add_column :keys, :type, :string - end -end diff --git a/db/migrate/20130506090604_create_deploy_keys_projects.rb b/db/migrate/20130506090604_create_deploy_keys_projects.rb deleted file mode 100644 index 8b9662a27c3..00000000000 --- a/db/migrate/20130506090604_create_deploy_keys_projects.rb +++ /dev/null @@ -1,13 +0,0 @@ -# rubocop:disable all -class CreateDeployKeysProjects < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :deploy_keys_projects do |t| - t.integer :deploy_key_id, null: false - t.integer :project_id, null: false - - t.timestamps null: true - end - end -end diff --git a/db/migrate/20130506095501_remove_project_id_from_key.rb b/db/migrate/20130506095501_remove_project_id_from_key.rb deleted file mode 100644 index 53abc4e7b52..00000000000 --- a/db/migrate/20130506095501_remove_project_id_from_key.rb +++ /dev/null @@ -1,23 +0,0 @@ -# rubocop:disable all -class RemoveProjectIdFromKey < ActiveRecord::Migration - def up - puts 'Migrate deploy keys: ' - Key.where('project_id IS NOT NULL').update_all(type: 'DeployKey') - - DeployKey.all.each do |key| - project = Project.find_by(id: key.project_id) - if project - project.deploy_keys << key - print '.' - end - end - - puts 'Done' - - remove_column :keys, :project_id - end - - def down - add_column :keys, :project_id, :integer - end -end diff --git a/db/migrate/20130522141856_add_more_fields_to_service.rb b/db/migrate/20130522141856_add_more_fields_to_service.rb deleted file mode 100644 index 9f764a1d050..00000000000 --- a/db/migrate/20130522141856_add_more_fields_to_service.rb +++ /dev/null @@ -1,7 +0,0 @@ -# rubocop:disable all -class AddMoreFieldsToService < ActiveRecord::Migration - def change - add_column :services, :subdomain, :string - add_column :services, :room, :string - end -end diff --git a/db/migrate/20130528184641_add_system_to_notes.rb b/db/migrate/20130528184641_add_system_to_notes.rb deleted file mode 100644 index 27fbf8983ac..00000000000 --- a/db/migrate/20130528184641_add_system_to_notes.rb +++ /dev/null @@ -1,17 +0,0 @@ -# rubocop:disable all -class AddSystemToNotes < ActiveRecord::Migration - class Note < ActiveRecord::Base - end - - def up - add_column :notes, :system, :boolean, default: false, null: false - - Note.reset_column_information - Note.update_all(system: false) - Note.where("note like '_status changed to%'").update_all(system: true) - end - - def down - remove_column :notes, :system - end -end diff --git a/db/migrate/20130611210815_increase_snippet_text_column_size.rb b/db/migrate/20130611210815_increase_snippet_text_column_size.rb deleted file mode 100644 index f710c79a9a5..00000000000 --- a/db/migrate/20130611210815_increase_snippet_text_column_size.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class IncreaseSnippetTextColumnSize < ActiveRecord::Migration - def up - # MYSQL LARGETEXT for snippet - change_column :snippets, :content, :text, :limit => 4294967295 - end - - def down - end -end diff --git a/db/migrate/20130613165816_add_password_expires_at_to_users.rb b/db/migrate/20130613165816_add_password_expires_at_to_users.rb deleted file mode 100644 index 47306a370a8..00000000000 --- a/db/migrate/20130613165816_add_password_expires_at_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddPasswordExpiresAtToUsers < ActiveRecord::Migration - def change - add_column :users, :password_expires_at, :datetime - end -end diff --git a/db/migrate/20130613173246_add_created_by_id_to_user.rb b/db/migrate/20130613173246_add_created_by_id_to_user.rb deleted file mode 100644 index 3138c0f40a7..00000000000 --- a/db/migrate/20130613173246_add_created_by_id_to_user.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddCreatedByIdToUser < ActiveRecord::Migration - def change - add_column :users, :created_by_id, :integer - end -end diff --git a/db/migrate/20130614132337_add_improted_to_project.rb b/db/migrate/20130614132337_add_improted_to_project.rb deleted file mode 100644 index 26dc16e3b43..00000000000 --- a/db/migrate/20130614132337_add_improted_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddImprotedToProject < ActiveRecord::Migration - def change - add_column :projects, :imported, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20130617095603_create_users_groups.rb b/db/migrate/20130617095603_create_users_groups.rb deleted file mode 100644 index 4ba7d0c9461..00000000000 --- a/db/migrate/20130617095603_create_users_groups.rb +++ /dev/null @@ -1,14 +0,0 @@ -# rubocop:disable all -class CreateUsersGroups < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :users_groups do |t| - t.integer :group_access, null: false - t.integer :group_id, null: false - t.integer :user_id, null: false - - t.timestamps null: true - end - end -end diff --git a/db/migrate/20130621195223_add_notification_level_to_user_group.rb b/db/migrate/20130621195223_add_notification_level_to_user_group.rb deleted file mode 100644 index 6fd4941f615..00000000000 --- a/db/migrate/20130621195223_add_notification_level_to_user_group.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddNotificationLevelToUserGroup < ActiveRecord::Migration - def change - add_column :users_groups, :notification_level, :integer, null: false, default: 3 - end -end diff --git a/db/migrate/20130622115340_add_more_db_index.rb b/db/migrate/20130622115340_add_more_db_index.rb deleted file mode 100644 index 4113217de59..00000000000 --- a/db/migrate/20130622115340_add_more_db_index.rb +++ /dev/null @@ -1,13 +0,0 @@ -# rubocop:disable all -class AddMoreDbIndex < ActiveRecord::Migration - def change - add_index :deploy_keys_projects, :project_id - add_index :web_hooks, :project_id - add_index :protected_branches, :project_id - - add_index :users_groups, :user_id - add_index :snippets, :author_id - add_index :notes, :author_id - add_index :notes, [:noteable_id, :noteable_type] - end -end diff --git a/db/migrate/20130624162710_add_fingerprint_to_key.rb b/db/migrate/20130624162710_add_fingerprint_to_key.rb deleted file mode 100644 index 3e574ea81b9..00000000000 --- a/db/migrate/20130624162710_add_fingerprint_to_key.rb +++ /dev/null @@ -1,7 +0,0 @@ -# rubocop:disable all -class AddFingerprintToKey < ActiveRecord::Migration - def change - add_column :keys, :fingerprint, :string - remove_column :keys, :identifier - end -end diff --git a/db/migrate/20130711063759_create_project_group_links.rb b/db/migrate/20130711063759_create_project_group_links.rb deleted file mode 100644 index efccb2aa938..00000000000 --- a/db/migrate/20130711063759_create_project_group_links.rb +++ /dev/null @@ -1,13 +0,0 @@ -# rubocop:disable all -class CreateProjectGroupLinks < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :project_group_links do |t| - t.integer :project_id, null: false - t.integer :group_id, null: false - - t.timestamps null: true - end - end -end diff --git a/db/migrate/20130804151314_add_st_diff_to_note.rb b/db/migrate/20130804151314_add_st_diff_to_note.rb deleted file mode 100644 index 9e2da73b695..00000000000 --- a/db/migrate/20130804151314_add_st_diff_to_note.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddStDiffToNote < ActiveRecord::Migration - def change - add_column :notes, :st_diff, :text, :null => true - end -end diff --git a/db/migrate/20130809124851_add_permission_check_to_user.rb b/db/migrate/20130809124851_add_permission_check_to_user.rb deleted file mode 100644 index 9f9dea36101..00000000000 --- a/db/migrate/20130809124851_add_permission_check_to_user.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddPermissionCheckToUser < ActiveRecord::Migration - def change - add_column :users, :last_credential_check_at, :datetime - end -end diff --git a/db/migrate/20130812143708_add_import_url_to_project.rb b/db/migrate/20130812143708_add_import_url_to_project.rb deleted file mode 100644 index d2bdfe1894e..00000000000 --- a/db/migrate/20130812143708_add_import_url_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddImportUrlToProject < ActiveRecord::Migration - def change - add_column :projects, :import_url, :string - end -end diff --git a/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb b/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb deleted file mode 100644 index 0e0e78b0f0d..00000000000 --- a/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb +++ /dev/null @@ -1,7 +0,0 @@ -# rubocop:disable all -class AddInternalIdsToIssuesAndMr < ActiveRecord::Migration - def change - add_column :issues, :iid, :integer - add_column :merge_requests, :iid, :integer - end -end diff --git a/db/migrate/20130820102832_add_access_to_project_group_link.rb b/db/migrate/20130820102832_add_access_to_project_group_link.rb deleted file mode 100644 index 98f3fa87523..00000000000 --- a/db/migrate/20130820102832_add_access_to_project_group_link.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddAccessToProjectGroupLink < ActiveRecord::Migration - def change - add_column :project_group_links, :group_access, :integer, null: false, default: ProjectGroupLink.default_access - end -end diff --git a/db/migrate/20130821090530_remove_deprecated_tables.rb b/db/migrate/20130821090530_remove_deprecated_tables.rb deleted file mode 100644 index d22e713a7a1..00000000000 --- a/db/migrate/20130821090530_remove_deprecated_tables.rb +++ /dev/null @@ -1,12 +0,0 @@ -# rubocop:disable all -class RemoveDeprecatedTables < ActiveRecord::Migration - def up - drop_table :user_teams - drop_table :user_team_project_relationships - drop_table :user_team_user_relationships - end - - def down - raise 'No rollback for this migration' - end -end diff --git a/db/migrate/20130821090531_add_internal_ids_to_milestones.rb b/db/migrate/20130821090531_add_internal_ids_to_milestones.rb deleted file mode 100644 index e25b8f91662..00000000000 --- a/db/migrate/20130821090531_add_internal_ids_to_milestones.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddInternalIdsToMilestones < ActiveRecord::Migration - def change - add_column :milestones, :iid, :integer - end -end diff --git a/db/migrate/20130909132950_add_description_to_merge_request.rb b/db/migrate/20130909132950_add_description_to_merge_request.rb deleted file mode 100644 index fbac50c8216..00000000000 --- a/db/migrate/20130909132950_add_description_to_merge_request.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddDescriptionToMergeRequest < ActiveRecord::Migration - def change - add_column :merge_requests, :description, :text, null: true - end -end diff --git a/db/migrate/20130926081215_change_owner_id_for_group.rb b/db/migrate/20130926081215_change_owner_id_for_group.rb deleted file mode 100644 index 2bdd22d5a04..00000000000 --- a/db/migrate/20130926081215_change_owner_id_for_group.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class ChangeOwnerIdForGroup < ActiveRecord::Migration - def up - change_column :namespaces, :owner_id, :integer, null: true - end - - def down - change_column :namespaces, :owner_id, :integer, null: false - end -end diff --git a/db/migrate/20131005191208_add_avatar_to_users.rb b/db/migrate/20131005191208_add_avatar_to_users.rb deleted file mode 100644 index df9057b81d6..00000000000 --- a/db/migrate/20131005191208_add_avatar_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddAvatarToUsers < ActiveRecord::Migration - def change - add_column :users, :avatar, :string - end -end diff --git a/db/migrate/20131009115346_add_confirmable_to_users.rb b/db/migrate/20131009115346_add_confirmable_to_users.rb deleted file mode 100644 index d714dd98e85..00000000000 --- a/db/migrate/20131009115346_add_confirmable_to_users.rb +++ /dev/null @@ -1,16 +0,0 @@ -# rubocop:disable all -class AddConfirmableToUsers < ActiveRecord::Migration - def self.up - add_column :users, :confirmation_token, :string - add_column :users, :confirmed_at, :datetime - add_column :users, :confirmation_sent_at, :datetime - add_column :users, :unconfirmed_email, :string - add_index :users, :confirmation_token, unique: true - User.update_all(confirmed_at: Time.now) - end - - def self.down - remove_column :users, :confirmation_token, :confirmed_at, :confirmation_sent_at - remove_column :users, :unconfirmed_email - end -end diff --git a/db/migrate/20131106151520_remove_default_branch.rb b/db/migrate/20131106151520_remove_default_branch.rb deleted file mode 100644 index fd3d1ed7ab3..00000000000 --- a/db/migrate/20131106151520_remove_default_branch.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class RemoveDefaultBranch < ActiveRecord::Migration - def up - remove_column :projects, :default_branch - end - - def down - add_column :projects, :default_branch, :string - end -end diff --git a/db/migrate/20131112114325_create_broadcast_messages.rb b/db/migrate/20131112114325_create_broadcast_messages.rb deleted file mode 100644 index ad2549e53af..00000000000 --- a/db/migrate/20131112114325_create_broadcast_messages.rb +++ /dev/null @@ -1,15 +0,0 @@ -# rubocop:disable all -class CreateBroadcastMessages < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :broadcast_messages do |t| - t.text :message, null: false - t.datetime :starts_at - t.datetime :ends_at - t.integer :alert_type - - t.timestamps null: true - end - end -end diff --git a/db/migrate/20131112220935_add_visibility_level_to_projects.rb b/db/migrate/20131112220935_add_visibility_level_to_projects.rb deleted file mode 100644 index 86d73753adc..00000000000 --- a/db/migrate/20131112220935_add_visibility_level_to_projects.rb +++ /dev/null @@ -1,16 +0,0 @@ -# rubocop:disable all -class AddVisibilityLevelToProjects < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def self.up - add_column :projects, :visibility_level, :integer, :default => 0, :null => false - execute("UPDATE projects SET visibility_level = #{Gitlab::VisibilityLevel::PUBLIC} WHERE public = #{true_value}") - remove_column :projects, :public - end - - def self.down - add_column :projects, :public, :boolean, :default => false, :null => false - execute("UPDATE projects SET public = #{true_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::PUBLIC}") - remove_column :projects, :visibility_level - end -end diff --git a/db/migrate/20131129154016_add_archived_to_projects.rb b/db/migrate/20131129154016_add_archived_to_projects.rb deleted file mode 100644 index e8e6908d137..00000000000 --- a/db/migrate/20131129154016_add_archived_to_projects.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddArchivedToProjects < ActiveRecord::Migration - def change - add_column :projects, :archived, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb b/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb deleted file mode 100644 index 348a284a53e..00000000000 --- a/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb +++ /dev/null @@ -1,7 +0,0 @@ -# rubocop:disable all -class AddColorAndFontToBroadcastMessages < ActiveRecord::Migration - def change - add_column :broadcast_messages, :color, :string - add_column :broadcast_messages, :font, :string - end -end diff --git a/db/migrate/20131202192556_add_event_fields_for_web_hook.rb b/db/migrate/20131202192556_add_event_fields_for_web_hook.rb deleted file mode 100644 index 99d76611524..00000000000 --- a/db/migrate/20131202192556_add_event_fields_for_web_hook.rb +++ /dev/null @@ -1,8 +0,0 @@ -# rubocop:disable all -class AddEventFieldsForWebHook < ActiveRecord::Migration - def change - add_column :web_hooks, :push_events, :boolean, default: true, null: false - add_column :web_hooks, :issues_events, :boolean, default: false, null: false - add_column :web_hooks, :merge_requests_events, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb b/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb deleted file mode 100644 index 4333dc59323..00000000000 --- a/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddHideNoSshKeyToUsers < ActiveRecord::Migration - def change - add_column :users, :hide_no_ssh_key, :boolean, :default => false - end -end diff --git a/db/migrate/20131217102743_add_recipients_to_service.rb b/db/migrate/20131217102743_add_recipients_to_service.rb deleted file mode 100644 index 3c76be0f68d..00000000000 --- a/db/migrate/20131217102743_add_recipients_to_service.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddRecipientsToService < ActiveRecord::Migration - def change - add_column :services, :recipients, :text - end -end diff --git a/db/migrate/20140116231608_add_website_url_to_users.rb b/db/migrate/20140116231608_add_website_url_to_users.rb deleted file mode 100644 index 1c39423562e..00000000000 --- a/db/migrate/20140116231608_add_website_url_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddWebsiteUrlToUsers < ActiveRecord::Migration - def change - add_column :users, :website_url, :string, {:null => false, :default => ''} - end -end diff --git a/db/migrate/20140122112253_create_merge_request_diffs.rb b/db/migrate/20140122112253_create_merge_request_diffs.rb deleted file mode 100644 index 6c7a92b6950..00000000000 --- a/db/migrate/20140122112253_create_merge_request_diffs.rb +++ /dev/null @@ -1,24 +0,0 @@ -# rubocop:disable all -class CreateMergeRequestDiffs < ActiveRecord::Migration - DOWNTIME = false - - def up - create_table :merge_request_diffs do |t| - t.string :state, null: false, default: 'collected' - t.text :st_commits, null: true - t.text :st_diffs, null: true - t.integer :merge_request_id, null: false - - t.timestamps null: true - end - - if ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ - change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647 - change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 - end - end - - def down - drop_table :merge_request_diffs - end -end diff --git a/db/migrate/20140122114406_migrate_mr_diffs.rb b/db/migrate/20140122114406_migrate_mr_diffs.rb deleted file mode 100644 index 429aeb2293f..00000000000 --- a/db/migrate/20140122114406_migrate_mr_diffs.rb +++ /dev/null @@ -1,10 +0,0 @@ -# rubocop:disable all -class MigrateMrDiffs < ActiveRecord::Migration - def self.up - execute "INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests" - end - - def self.down - MergeRequestDiff.delete_all - end -end diff --git a/db/migrate/20140122122549_remove_m_rdiff_fields.rb b/db/migrate/20140122122549_remove_m_rdiff_fields.rb deleted file mode 100644 index bbf35811b61..00000000000 --- a/db/migrate/20140122122549_remove_m_rdiff_fields.rb +++ /dev/null @@ -1,22 +0,0 @@ -# rubocop:disable all -class RemoveMRdiffFields < ActiveRecord::Migration - def up - remove_column :merge_requests, :st_commits - remove_column :merge_requests, :st_diffs - end - - def down - add_column :merge_requests, :st_commits, :text, null: true, limit: 2147483647 - add_column :merge_requests, :st_diffs, :text, null: true, limit: 2147483647 - - if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' - execute "UPDATE merge_requests mr - SET (st_commits, st_diffs) = (md.st_commits, md.st_diffs) - FROM merge_request_diffs md - WHERE md.merge_request_id = mr.id" - else - execute "UPDATE merge_requests mr, merge_request_diffs md SET mr.st_commits = md.st_commits WHERE md.merge_request_id = mr.id" - execute "UPDATE merge_requests mr, merge_request_diffs md SET mr.st_diffs = md.st_diffs WHERE md.merge_request_id = mr.id" - end - end -end diff --git a/db/migrate/20140125162722_add_avatar_to_projects.rb b/db/migrate/20140125162722_add_avatar_to_projects.rb deleted file mode 100644 index 888341b7535..00000000000 --- a/db/migrate/20140125162722_add_avatar_to_projects.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddAvatarToProjects < ActiveRecord::Migration - def change - add_column :projects, :avatar, :string - end -end diff --git a/db/migrate/20140127170938_add_group_avatars.rb b/db/migrate/20140127170938_add_group_avatars.rb deleted file mode 100644 index 95d1c1c6b27..00000000000 --- a/db/migrate/20140127170938_add_group_avatars.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddGroupAvatars < ActiveRecord::Migration - def change - add_column :namespaces, :avatar, :string - end -end diff --git a/db/migrate/20140209025651_create_emails.rb b/db/migrate/20140209025651_create_emails.rb deleted file mode 100644 index 51886f8fc89..00000000000 --- a/db/migrate/20140209025651_create_emails.rb +++ /dev/null @@ -1,16 +0,0 @@ -# rubocop:disable all -class CreateEmails < ActiveRecord::Migration - DOWNTIME = false - - def change - create_table :emails do |t| - t.integer :user_id, null: false - t.string :email, null: false - - t.timestamps null: true - end - - add_index :emails, :user_id - add_index :emails, :email, unique: true - end -end diff --git a/db/migrate/20140214102325_add_api_key_to_services.rb b/db/migrate/20140214102325_add_api_key_to_services.rb deleted file mode 100644 index b58c36c0a30..00000000000 --- a/db/migrate/20140214102325_add_api_key_to_services.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddApiKeyToServices < ActiveRecord::Migration - def change - add_column :services, :api_key, :string - end -end diff --git a/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb b/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb deleted file mode 100644 index aab8a41c2c3..00000000000 --- a/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddIndexMergeRequestDiffsOnMergeRequestId < ActiveRecord::Migration - def change - add_index :merge_request_diffs, :merge_request_id, unique: true - end -end diff --git a/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb b/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb deleted file mode 100644 index ec163bb843c..00000000000 --- a/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddTagPushHooksToProjectHook < ActiveRecord::Migration - def change - add_column :web_hooks, :tag_push_events, :boolean, default: false - end -end diff --git a/db/migrate/20140312145357_add_import_status_to_project.rb b/db/migrate/20140312145357_add_import_status_to_project.rb deleted file mode 100644 index 9947cd8c6f9..00000000000 --- a/db/migrate/20140312145357_add_import_status_to_project.rb +++ /dev/null @@ -1,6 +0,0 @@ -# rubocop:disable all -class AddImportStatusToProject < ActiveRecord::Migration - def change - add_column :projects, :import_status, :string - end -end diff --git a/db/migrate/20140313092127_init_schema.rb b/db/migrate/20140313092127_init_schema.rb new file mode 100644 index 00000000000..e5c3b65fa8d --- /dev/null +++ b/db/migrate/20140313092127_init_schema.rb @@ -0,0 +1,335 @@ +class InitSchema < ActiveRecord::Migration + def up + create_table "broadcast_messages", force: :cascade do |t| + t.text "message", null: false + t.datetime "starts_at" + t.datetime "ends_at" + t.integer "alert_type" + t.datetime "created_at" + t.datetime "updated_at" + t.string "color" + t.string "font" + end + create_table "deploy_keys_projects", force: :cascade do |t| + t.integer "deploy_key_id", null: false + t.integer "project_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree + create_table "emails", force: :cascade do |t| + t.integer "user_id", null: false + t.string "email", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + add_index "emails", ["email"], name: "index_emails_on_email", unique: true, using: :btree + add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree + create_table "events", force: :cascade do |t| + t.string "target_type" + t.integer "target_id" + t.string "title" + t.text "data" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "action" + t.integer "author_id" + end + add_index "events", ["action"], name: "index_events_on_action", using: :btree + add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree + add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree + add_index "events", ["project_id"], name: "index_events_on_project_id", using: :btree + add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree + add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree + create_table "forked_project_links", force: :cascade do |t| + t.integer "forked_to_project_id", null: false + t.integer "forked_from_project_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree + create_table "issues", force: :cascade do |t| + t.string "title" + t.integer "assignee_id" + t.integer "author_id" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "position", default: 0 + t.string "branch_name" + t.text "description" + t.integer "milestone_id" + t.string "state" + t.integer "iid" + end + add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree + add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree + add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree + add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree + add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree + add_index "issues", ["title"], name: "index_issues_on_title", using: :btree + create_table "keys", force: :cascade do |t| + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "key" + t.string "title" + t.string "type" + t.string "fingerprint" + end + add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree + create_table "merge_request_diffs", force: :cascade do |t| + t.string "state", default: "collected", null: false + t.text "st_commits" + t.text "st_diffs" + t.integer "merge_request_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + add_index "merge_request_diffs", ["merge_request_id"], name: "index_merge_request_diffs_on_merge_request_id", unique: true, using: :btree + create_table "merge_requests", force: :cascade do |t| + t.string "target_branch", null: false + t.string "source_branch", null: false + t.integer "source_project_id", null: false + t.integer "author_id" + t.integer "assignee_id" + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "milestone_id" + t.string "state" + t.string "merge_status" + t.integer "target_project_id", null: false + t.integer "iid" + t.text "description" + end + add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree + add_index "merge_requests", ["author_id"], name: "index_merge_requests_on_author_id", using: :btree + add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree + add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree + add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree + add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree + add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree + add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree + create_table "milestones", force: :cascade do |t| + t.string "title", null: false + t.integer "project_id", null: false + t.text "description" + t.date "due_date" + t.datetime "created_at" + t.datetime "updated_at" + t.string "state" + t.integer "iid" + end + add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree + add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree + create_table "namespaces", force: :cascade do |t| + t.string "name", null: false + t.string "path", null: false + t.integer "owner_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type" + t.string "description", default: "", null: false + t.string "avatar" + end + add_index "namespaces", ["name"], name: "index_namespaces_on_name", using: :btree + add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree + add_index "namespaces", ["path"], name: "index_namespaces_on_path", using: :btree + add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree + create_table "notes", force: :cascade do |t| + t.text "note" + t.string "noteable_type" + t.integer "author_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_id" + t.string "attachment" + t.string "line_code" + t.string "commit_id" + t.integer "noteable_id" + t.boolean "system", default: false, null: false + t.text "st_diff" + end + add_index "notes", ["author_id"], name: "index_notes_on_author_id", using: :btree + add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree + add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree + add_index "notes", ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type", using: :btree + add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree + add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree + add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree + create_table "project_group_links", force: :cascade do |t| + t.integer "project_id", null: false + t.integer "group_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "group_access", default: 30, null: false + end + create_table "projects", force: :cascade do |t| + t.string "name" + t.string "path" + t.text "description" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "creator_id" + t.boolean "issues_enabled", default: true, null: false + t.boolean "wall_enabled", default: true, null: false + t.boolean "merge_requests_enabled", default: true, null: false + t.boolean "wiki_enabled", default: true, null: false + t.integer "namespace_id" + t.string "issues_tracker", default: "gitlab", null: false + t.string "issues_tracker_id" + t.boolean "snippets_enabled", default: true, null: false + t.datetime "last_activity_at" + t.string "import_url" + t.integer "visibility_level", default: 0, null: false + t.boolean "archived", default: false, null: false + t.string "avatar" + t.string "import_status" + end + add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree + add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree + add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree + create_table "protected_branches", force: :cascade do |t| + t.integer "project_id", null: false + t.string "name", null: false + t.datetime "created_at" + t.datetime "updated_at" + end + add_index "protected_branches", ["project_id"], name: "index_protected_branches_on_project_id", using: :btree + create_table "services", force: :cascade do |t| + t.string "type" + t.string "title" + t.string "token" + t.integer "project_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "active", default: false, null: false + t.string "project_url" + t.string "subdomain" + t.string "room" + t.text "recipients" + t.string "api_key" + end + add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree + create_table "snippets", force: :cascade do |t| + t.string "title" + t.text "content" + t.integer "author_id", null: false + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_name" + t.datetime "expires_at" + t.boolean "private", default: true, null: false + t.string "type" + end + add_index "snippets", ["author_id"], name: "index_snippets_on_author_id", using: :btree + add_index "snippets", ["created_at"], name: "index_snippets_on_created_at", using: :btree + add_index "snippets", ["expires_at"], name: "index_snippets_on_expires_at", using: :btree + add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree + create_table "taggings", force: :cascade do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context" + t.datetime "created_at" + end + add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree + add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree + create_table "tags", force: :cascade do |t| + t.string "name" + end + create_table "users", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.string "name" + t.boolean "admin", default: false, null: false + t.integer "projects_limit", default: 10 + t.string "skype", default: "", null: false + t.string "linkedin", default: "", null: false + t.string "twitter", default: "", null: false + t.string "authentication_token" + t.integer "theme_id", default: 1, null: false + t.string "bio" + t.integer "failed_attempts", default: 0 + t.datetime "locked_at" + t.string "extern_uid" + t.string "provider" + t.string "username" + t.boolean "can_create_group", default: true, null: false + t.boolean "can_create_team", default: true, null: false + t.string "state" + t.integer "color_scheme_id", default: 1, null: false + t.integer "notification_level", default: 1, null: false + t.datetime "password_expires_at" + t.integer "created_by_id" + t.datetime "last_credential_check_at" + t.string "avatar" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.boolean "hide_no_ssh_key", default: false + t.string "website_url", default: "", null: false + end + add_index "users", ["admin"], name: "index_users_on_admin", using: :btree + add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree + add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree + add_index "users", ["name"], name: "index_users_on_name", using: :btree + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + add_index "users", ["username"], name: "index_users_on_username", using: :btree + create_table "users_groups", force: :cascade do |t| + t.integer "group_access", null: false + t.integer "group_id", null: false + t.integer "user_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "notification_level", default: 3, null: false + end + add_index "users_groups", ["user_id"], name: "index_users_groups_on_user_id", using: :btree + create_table "users_projects", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "project_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_access", default: 0, null: false + t.integer "notification_level", default: 3, null: false + end + add_index "users_projects", ["project_access"], name: "index_users_projects_on_project_access", using: :btree + add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree + add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree + create_table "web_hooks", force: :cascade do |t| + t.string "url" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type", default: "ProjectHook" + t.integer "service_id" + t.boolean "push_events", default: true, null: false + t.boolean "issues_events", default: false, null: false + t.boolean "merge_requests_events", default: false, null: false + t.boolean "tag_push_events", default: false + end + add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree + end + + def down + raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable" + end +end diff --git a/db/migrate/20140313092127_migrate_already_imported_projects.rb b/db/migrate/20140313092127_migrate_already_imported_projects.rb deleted file mode 100644 index 0afc26b8764..00000000000 --- a/db/migrate/20140313092127_migrate_already_imported_projects.rb +++ /dev/null @@ -1,15 +0,0 @@ -# rubocop:disable all -class MigrateAlreadyImportedProjects < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - def up - execute("UPDATE projects SET import_status = 'finished' WHERE imported = #{true_value}") - execute("UPDATE projects SET import_status = 'none' WHERE imported = #{false_value}") - remove_column :projects, :imported - end - - def down - add_column :projects, :imported, :boolean, default: false - execute("UPDATE projects SET imported = #{true_value} WHERE import_status = 'finished'") - end -end diff --git a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb new file mode 100644 index 00000000000..6fabe07bc9c --- /dev/null +++ b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb @@ -0,0 +1,27 @@ +class AddPipelineBuildForeignKey < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + execute <<~SQL + DELETE FROM ci_builds WHERE project_id IS NULL OR commit_id IS NULL + SQL + + execute <<~SQL + DELETE FROM ci_builds WHERE NOT EXISTS + (SELECT true FROM ci_pipelines WHERE ci_pipelines.id = ci_builds.commit_id) + AND stage_id IS NULL + SQL + + add_concurrent_foreign_key(:ci_builds, :ci_pipelines, column: :commit_id) + end + + def down + return unless foreign_key_exists?(:ci_builds, :ci_pipelines, column: :commit_id) + + remove_foreign_key(:ci_builds, column: :commit_id) + end +end diff --git a/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb b/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb new file mode 100644 index 00000000000..0d8a8357a1e --- /dev/null +++ b/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb @@ -0,0 +1,11 @@ +class MakeRemoteMirrorsDisabledByDefault < ActiveRecord::Migration + DOWNTIME = false + + def up + change_column_default :remote_mirrors, :enabled, false + end + + def down + change_column_default :remote_mirrors, :enabled, true + end +end diff --git a/db/schema.rb b/db/schema.rb index 65e9cc4ea08..6fd10785d77 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180503200320) do +ActiveRecord::Schema.define(version: 20180508055821) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1712,7 +1712,7 @@ ActiveRecord::Schema.define(version: 20180503200320) do create_table "remote_mirrors", force: :cascade do |t| t.integer "project_id" t.string "url" - t.boolean "enabled", default: true + t.boolean "enabled", default: false t.string "update_status" t.datetime "last_update_at" t.datetime "last_successful_update_at" diff --git a/doc/development/README.md b/doc/development/README.md index 3c77e99b8cf..32ae86a7150 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -18,6 +18,7 @@ comments: false - [Code review guidelines](code_review.md) for reviewing code and having code reviewed. - [Automatic CE->EE merge](automatic_ce_ee_merge.md) - [Guidelines for implementing Enterprise Edition features](ee_features.md) +- [Security process for developers](https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md#security-releases-critical-non-critical-as-a-developer) ## UX and frontend guides diff --git a/lib/api/entities.rb b/lib/api/entities.rb index a9bab5c56cf..25d78fc761d 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -967,6 +967,7 @@ module API class Runner < Grape::Entity expose :id expose :description + expose :ip_address expose :active expose :is_shared expose :name diff --git a/package.json b/package.json index 4a1a594454c..9543dba1bbc 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "raw-loader": "^0.5.1", "sanitize-html": "^1.16.1", "select2": "3.5.2-browserify", + "sha1": "^1.1.1", "sql.js": "^0.4.0", "style-loader": "^0.21.0", "svg4everybody": "2.1.9", diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 990e5c4d9df..a29c21f6fef 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -3,10 +3,11 @@ require 'spec_helper' describe 'Pipeline', :js do let(:project) { create(:project) } let(:user) { create(:user) } + let(:role) { :developer } before do sign_in(user) - project.add_developer(user) + project.add_role(user, role) end shared_context 'pipeline builds' do @@ -153,9 +154,10 @@ describe 'Pipeline', :js do end context 'page tabs' do - it 'shows Pipeline and Jobs tabs with link' do + it 'shows Pipeline, Jobs and Failed Jobs tabs with link' do expect(page).to have_link('Pipeline') expect(page).to have_link('Jobs') + expect(page).to have_link('Failed Jobs') end it 'shows counter in Jobs tab' do @@ -165,6 +167,16 @@ describe 'Pipeline', :js do it 'shows Pipeline tab as active' do expect(page).to have_css('.js-pipeline-tab-link.active') end + + context 'without permission to access builds' do + let(:project) { create(:project, :public, :repository, public_builds: false) } + let(:role) { :guest } + + it 'does not show failed jobs tab pane' do + expect(page).to have_link('Pipeline') + expect(page).not_to have_content('Failed Jobs') + end + end end context 'retrying jobs' do @@ -308,8 +320,7 @@ describe 'Pipeline', :js do end describe 'GET /:project/pipelines/:id/failures' do - let(:project) { create(:project, :repository) } - let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } + let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: '1234') } let(:pipeline_failures_page) { failures_project_pipeline_path(project, pipeline) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline) } @@ -340,11 +351,39 @@ describe 'Pipeline', :js do visit pipeline_failures_page end - it 'includes failed jobs' do + it 'shows jobs tab pane as active' do + expect(page).to have_content('Failed Jobs') + expect(page).to have_css('#js-tab-failures.active') + end + + it 'lists failed builds' do + expect(page).to have_content(failed_build.name) + expect(page).to have_content(failed_build.stage) + end + + it 'does not show trace' do expect(page).to have_content('No job trace') end end + context 'without permission to access builds' do + let(:role) { :guest } + + before do + project.update(public_builds: false) + end + + context 'when accessing failed jobs page' do + before do + visit pipeline_failures_page + end + + it 'fails to access the page' do + expect(page).to have_content('Access Denied') + end + end + end + context 'without failures' do before do failed_build.update!(status: :success) diff --git a/spec/migrations/add_pipeline_build_foreign_key_spec.rb b/spec/migrations/add_pipeline_build_foreign_key_spec.rb new file mode 100644 index 00000000000..e9413f52f19 --- /dev/null +++ b/spec/migrations/add_pipeline_build_foreign_key_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20180420010016_add_pipeline_build_foreign_key.rb') + +describe AddPipelineBuildForeignKey, :migration do + let(:namespaces) { table(:namespaces) } + let(:projects) { table(:projects) } + let(:pipelines) { table(:ci_pipelines) } + let(:builds) { table(:ci_builds) } + + before do + namespaces.create(id: 10, name: 'gitlab-org', path: 'gitlab-org') + projects.create!(id: 11, namespace_id: 10, name: 'gitlab', path: 'gitlab') + pipelines.create!(id: 12, project_id: 11, ref: 'master', sha: 'adf43c3a') + + builds.create!(id: 101, commit_id: 12, project_id: 11) + builds.create!(id: 102, commit_id: 222, project_id: 11) + builds.create!(id: 103, commit_id: 333, project_id: 11) + builds.create!(id: 104, commit_id: 12, project_id: 11) + builds.create!(id: 106, commit_id: nil, project_id: 11) + builds.create!(id: 107, commit_id: 12, project_id: nil) + end + + it 'adds foreign key after removing orphans' do + expect(builds.all.count).to eq 6 + expect(foreign_key_exists?(:ci_builds, :ci_pipelines, column: :commit_id)).to be_falsey + + migrate! + + expect(builds.all.pluck(:id)).to eq [101, 104] + expect(foreign_key_exists?(:ci_builds, :ci_pipelines, column: :commit_id)).to be_truthy + end +end diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb index a5d505af001..4570dbb1d8e 100644 --- a/spec/models/concerns/reactive_caching_spec.rb +++ b/spec/models/concerns/reactive_caching_spec.rb @@ -29,12 +29,6 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do end end - let(:now) { Time.now.utc } - - around do |example| - Timecop.freeze(now) { example.run } - end - let(:calculation) { -> { 2 + 2 } } let(:cache_key) { "foo:666" } let(:instance) { CacheTest.new(666, &calculation) } @@ -49,13 +43,15 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do context 'when cache is empty' do it { is_expected.to be_nil } - it 'queues a background worker' do + it 'enqueues a background worker to bootstrap the cache' do expect(ReactiveCachingWorker).to receive(:perform_async).with(CacheTest, 666) go! end it 'updates the cache lifespan' do + expect(reactive_cache_alive?(instance)).to be_falsy + go! expect(reactive_cache_alive?(instance)).to be_truthy @@ -69,6 +65,18 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do it { is_expected.to eq(2) } + it 'does not enqueue a background worker' do + expect(ReactiveCachingWorker).not_to receive(:perform_async) + + go! + end + + it 'updates the cache lifespan' do + expect(Rails.cache).to receive(:write).with(alive_reactive_cache_key(instance), true, expires_in: anything) + + go! + end + context 'and expired' do before do invalidate_reactive_cache(instance) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 41622fbbb6f..a6e835e563d 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1885,8 +1885,6 @@ describe Project do update_remote_mirrors end - # TODO: study if remote_mirror_available_overridden is still a necessary attribute considering that - # it is no longer under any license it 'does nothing when remote mirror is disabled globally and not overridden' do stub_application_setting(mirror_available: false) project.remote_mirror_available_overridden = false diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index f22fec31514..981ac768e3a 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -46,6 +46,7 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array + expect(json_response[0]).to have_key('ip_address') expect(descriptions).to contain_exactly( 'Project runner', 'Two projects runner' ) @@ -59,6 +60,7 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array + expect(json_response[0]).to have_key('ip_address') expect(shared).to be_falsey end @@ -87,6 +89,7 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array + expect(json_response[0]).to have_key('ip_address') expect(shared).to be_truthy end end @@ -106,6 +109,7 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array + expect(json_response[0]).to have_key('ip_address') expect(shared).to be_falsey end @@ -515,6 +519,7 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array + expect(json_response[0]).to have_key('ip_address') expect(shared).to be_truthy end end diff --git a/spec/support/helpers/migrations_helpers.rb b/spec/support/helpers/migrations_helpers.rb index 5d6f662e8fe..84abec75c26 100644 --- a/spec/support/helpers/migrations_helpers.rb +++ b/spec/support/helpers/migrations_helpers.rb @@ -24,6 +24,16 @@ module MigrationsHelpers end end + def foreign_key_exists?(source, target = nil, column: nil) + ActiveRecord::Base.connection.foreign_keys(source).any? do |key| + if column + key.options[:column].to_s == column.to_s + else + key.to_table.to_s == target.to_s + end + end + end + def reset_column_in_all_models clear_schema_cache! diff --git a/yarn.lock b/yarn.lock index 2d18a694e9d..d3d04fa0d47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1586,6 +1586,10 @@ chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" +"charenc@>= 0.0.1": + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + chart.js@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-1.0.2.tgz#ad57d2229cfd8ccf5955147e8121b4911e69dfe7" @@ -2086,6 +2090,10 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +"crypt@>= 0.0.1": + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -7859,6 +7867,13 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +sha1@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/sha1/-/sha1-1.1.1.tgz#addaa7a93168f393f19eb2b15091618e2700f848" + dependencies: + charenc ">= 0.0.1" + crypt ">= 0.0.1" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" |