Sha256: fe295b21d22492d71f29158b5347fe7745d50cade683a758b804df241938d5ce
Contents?: true
Size: 1.82 KB
Versions: 1
Compression:
Stored size: 1.82 KB
Contents
describe 'Ridgepole::Client#diff -> migrate' do subject { client } before do subject.diff(actual_dsl).migrate end context 'when drop column from table containing an expression index' do let(:actual_dsl) { erbh(<<-EOS) } create_table "users", force: :cascade do |t| t.string "name", null: false t.datetime "created_at", null: false t.index "lower((name)::text)", <%= i({name: "index_users_on_lower_name"} + cond(5.0, using: :btree)) %> end EOS let(:expected_dsl) { erbh(<<-EOS) } create_table "users", force: :cascade do |t| t.string "name", null: false t.index "lower((name)::text)", <%= i({name: "index_users_on_lower_name"} + cond(5.0, using: :btree)) %> end EOS specify do delta = subject.diff(expected_dsl) expect(delta).to be_differ expect(delta.script).to match_fuzzy('remove_column("users", "created_at")') expect(subject.dump).to match_fuzzy(actual_dsl) delta.migrate expect(subject.dump).to match_fuzzy(expected_dsl) end end context 'when drop expression index' do let(:actual_dsl) { erbh(<<-EOS) } create_table "users", force: :cascade do |t| t.string "name", null: false t.index "lower((name)::text)", <%= i({name: "index_users_on_lower_name"} + cond(5.0, using: :btree)) %> end EOS let(:expected_dsl) { <<-EOS } create_table "users", force: :cascade do |t| t.string "name", null: false end EOS specify do delta = subject.diff(expected_dsl) expect(delta).to be_differ expect(delta.script).to match_fuzzy('remove_index("users", {:name=>"index_users_on_lower_name"})') expect(subject.dump).to match_fuzzy(actual_dsl) delta.migrate expect(subject.dump).to match_fuzzy(expected_dsl) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ridgepole-0.7.0.alpha | spec/postgresql/migrate/migrate_drop_expression_index_spec.rb |