Commit b4b1f69a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove default relative_position value

This makes `epic_issues` consistent with other tables
using our `RelativePositioning` class
parent 44aa23b9
# frozen_string_literal: true
class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
change_column_null :epic_issues, :relative_position, true
change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_08_02_235445) do ActiveRecord::Schema.define(version: 2019_08_06_071559) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm" enable_extension "pg_trgm"
...@@ -1194,7 +1194,7 @@ ActiveRecord::Schema.define(version: 2019_08_02_235445) do ...@@ -1194,7 +1194,7 @@ ActiveRecord::Schema.define(version: 2019_08_02_235445) do
create_table "epic_issues", id: :serial, force: :cascade do |t| create_table "epic_issues", id: :serial, force: :cascade do |t|
t.integer "epic_id", null: false t.integer "epic_id", null: false
t.integer "issue_id", null: false t.integer "issue_id", null: false
t.integer "relative_position", default: 1073741823, null: false t.integer "relative_position"
t.index ["epic_id"], name: "index_epic_issues_on_epic_id" t.index ["epic_id"], name: "index_epic_issues_on_epic_id"
t.index ["issue_id"], name: "index_epic_issues_on_issue_id", unique: true t.index ["issue_id"], name: "index_epic_issues_on_issue_id", unique: true
end end
......
...@@ -17,8 +17,8 @@ RSpec.shared_examples 'a class that supports relative positioning' do ...@@ -17,8 +17,8 @@ RSpec.shared_examples 'a class that supports relative positioning' do
describe '.move_nulls_to_end' do describe '.move_nulls_to_end' do
it 'moves items with null relative_position to the end' do it 'moves items with null relative_position to the end' do
skip("#{item1} has a default relative position") if item1.relative_position item1.update!(relative_position: nil)
skip("#{item2} has a default relative position") if item2.relative_position item2.update!(relative_position: nil)
described_class.move_nulls_to_end([item1, item2]) described_class.move_nulls_to_end([item1, item2])
...@@ -28,7 +28,7 @@ RSpec.shared_examples 'a class that supports relative positioning' do ...@@ -28,7 +28,7 @@ RSpec.shared_examples 'a class that supports relative positioning' do
end end
it 'moves the item near the start position when there are no existing positions' do it 'moves the item near the start position when there are no existing positions' do
skip("#{item1} has a default relative position") if item1.relative_position item1.update!(relative_position: nil)
described_class.move_nulls_to_end([item1]) described_class.move_nulls_to_end([item1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment