diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-01-27 03:23:07 -0200 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-02-03 17:02:43 +0300 |
commit | 682d213f431ea83f277fc2a362c994ee17c2f44b (patch) | |
tree | cfd432bb4fb12a49506bad6a61076fc8788284f3 | |
parent | 3aabf0c6aa2b76ef4458250ca98876e3f268fe14 (diff) | |
download | gitlab-ce-682d213f431ea83f277fc2a362c994ee17c2f44b.tar.gz |
Remove backlog lists from boards
-rw-r--r-- | app/models/board.rb | 4 | ||||
-rw-r--r-- | app/models/list.rb | 2 | ||||
-rw-r--r-- | db/migrate/20170127032550_remove_backlog_lists_from_boards.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 41 | ||||
-rw-r--r-- | spec/models/list_spec.rb | 39 |
5 files changed, 50 insertions, 55 deletions
diff --git a/app/models/board.rb b/app/models/board.rb index c56422914a9..2780acc67c0 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -5,10 +5,6 @@ class Board < ActiveRecord::Base validates :project, presence: true - def backlog_list - lists.merge(List.backlog).take - end - def done_list lists.merge(List.done).take end diff --git a/app/models/list.rb b/app/models/list.rb index 065d75bd1dc..1e5da7f4dd4 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -2,7 +2,7 @@ class List < ActiveRecord::Base belongs_to :board belongs_to :label - enum list_type: { backlog: 0, label: 1, done: 2 } + enum list_type: { label: 1, done: 2 } validates :board, :list_type, presence: true validates :label, :position, presence: true, if: :label? diff --git a/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb b/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb new file mode 100644 index 00000000000..3369bd4d123 --- /dev/null +++ b/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb @@ -0,0 +1,19 @@ +class RemoveBacklogListsFromBoards < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + execute <<-SQL + DELETE FROM lists WHERE list_type = 0; + SQL + end + + def down + execute <<-SQL + INSERT INTO lists (board_id, list_type, created_at, updated_at) + SELECT boards.id, 0, NOW(), NOW() + FROM boards; + SQL + end +end diff --git a/db/schema.rb b/db/schema.rb index c73c311ccb2..d887b441189 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -87,9 +87,9 @@ ActiveRecord::Schema.define(version: 20170130204620) do t.boolean "send_user_confirmation_email", default: false t.integer "container_registry_token_expire_delay", default: 5 t.text "after_sign_up_text" - t.boolean "user_default_external", default: false, null: false t.string "repository_storages", default: "default" t.string "enabled_git_access_protocol" + t.boolean "user_default_external", default: false, null: false t.boolean "domain_blacklist_enabled", default: false t.text "domain_blacklist" t.boolean "koding_enabled" @@ -98,14 +98,14 @@ ActiveRecord::Schema.define(version: 20170130204620) do t.text "help_page_text_html" t.text "shared_runners_text_html" t.text "after_sign_up_text_html" - t.boolean "sidekiq_throttling_enabled", default: false - t.string "sidekiq_throttling_queues" - t.decimal "sidekiq_throttling_factor" t.boolean "housekeeping_enabled", default: true, null: false t.boolean "housekeeping_bitmaps_enabled", default: true, null: false t.integer "housekeeping_incremental_repack_period", default: 10, null: false t.integer "housekeeping_full_repack_period", default: 50, null: false t.integer "housekeeping_gc_period", default: 200, null: false + t.boolean "sidekiq_throttling_enabled", default: false + t.string "sidekiq_throttling_queues" + t.decimal "sidekiq_throttling_factor" t.boolean "html_emails_enabled", default: true t.string "plantuml_url" t.boolean "plantuml_enabled" @@ -398,22 +398,22 @@ ActiveRecord::Schema.define(version: 20170130204620) do add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree create_table "deployments", force: :cascade do |t| - t.integer "iid", null: false - t.integer "project_id", null: false - t.integer "environment_id", null: false - t.string "ref", null: false - t.boolean "tag", null: false - t.string "sha", null: false + t.integer "iid" + t.integer "project_id" + t.integer "environment_id" + t.string "ref" + t.boolean "tag" + t.string "sha" t.integer "user_id" - t.integer "deployable_id" - t.string "deployable_type" + t.integer "deployable_id", null: false + t.string "deployable_type", null: false t.datetime "created_at" t.datetime "updated_at" t.string "on_stop" end add_index "deployments", ["project_id", "environment_id", "iid"], name: "index_deployments_on_project_id_and_environment_id_and_iid", using: :btree - add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree + add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", using: :btree create_table "emails", force: :cascade do |t| t.integer "user_id", null: false @@ -685,8 +685,8 @@ ActiveRecord::Schema.define(version: 20170130204620) do t.integer "merge_user_id" t.string "merge_commit_sha" t.datetime "deleted_at" - t.string "in_progress_merge_commit_sha" t.integer "lock_version" + t.string "in_progress_merge_commit_sha" t.text "title_html" t.text "description_html" t.integer "time_estimate" @@ -763,6 +763,16 @@ ActiveRecord::Schema.define(version: 20170130204620) do add_index "namespaces", ["path"], name: "index_namespaces_on_path_trigram", using: :gin, opclasses: {"path"=>"gin_trgm_ops"} add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree + create_table "note_templates", force: :cascade do |t| + t.integer "user_id" + t.string "title" + t.text "note" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "note_templates", ["user_id"], name: "index_note_templates_on_user_id", using: :btree + create_table "notes", force: :cascade do |t| t.text "note" t.string "noteable_type" @@ -778,6 +788,7 @@ ActiveRecord::Schema.define(version: 20170130204620) do t.text "st_diff" t.integer "updated_by_id" t.string "type" + t.string "system_type" t.text "position" t.text "original_position" t.datetime "resolved_at" @@ -960,7 +971,7 @@ ActiveRecord::Schema.define(version: 20170130204620) do t.boolean "has_external_wiki" t.boolean "lfs_enabled" t.text "description_html" - t.boolean "only_allow_merge_if_all_discussions_are_resolved" + t.boolean "only_allow_merge_if_all_discussions_are_resolved", default: false, null: false end add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index 9e1a52011c3..e6ca4853873 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -19,13 +19,6 @@ describe List do expect(subject).to validate_uniqueness_of(:label_id).scoped_to(:board_id) end - context 'when list_type is set to backlog' do - subject { described_class.new(list_type: :backlog) } - - it { is_expected.not_to validate_presence_of(:label) } - it { is_expected.not_to validate_presence_of(:position) } - end - context 'when list_type is set to done' do subject { described_class.new(list_type: :done) } @@ -41,12 +34,6 @@ describe List do expect(subject.destroy).to be_truthy end - it 'can not be destroyed when list_type is set to backlog' do - subject = create(:backlog_list) - - expect(subject.destroy).to be_falsey - end - it 'can not be destroyed when when list_type is set to done' do subject = create(:done_list) @@ -55,19 +42,13 @@ describe List do end describe '#destroyable?' do - it 'retruns true when list_type is set to label' do + it 'returns true when list_type is set to label' do subject.list_type = :label expect(subject).to be_destroyable end - it 'retruns false when list_type is set to backlog' do - subject.list_type = :backlog - - expect(subject).not_to be_destroyable - end - - it 'retruns false when list_type is set to done' do + it 'returns false when list_type is set to done' do subject.list_type = :done expect(subject).not_to be_destroyable @@ -75,19 +56,13 @@ describe List do end describe '#movable?' do - it 'retruns true when list_type is set to label' do + it 'returns true when list_type is set to label' do subject.list_type = :label expect(subject).to be_movable end - it 'retruns false when list_type is set to backlog' do - subject.list_type = :backlog - - expect(subject).not_to be_movable - end - - it 'retruns false when list_type is set to done' do + it 'returns false when list_type is set to done' do subject.list_type = :done expect(subject).not_to be_movable @@ -102,12 +77,6 @@ describe List do expect(subject.title).to eq 'Development' end - it 'returns Backlog when list_type is set to backlog' do - subject.list_type = :backlog - - expect(subject.title).to eq 'Backlog' - end - it 'returns Done when list_type is set to done' do subject.list_type = :done |