Sha256: 01856027310ded8f31c1fa610f8bf1991614044937dd65c5d4f17f568b04aa73

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

unless postgresql?
describe 'Ridgepole::Client#diff -> migrate' do
  context 'when change fk' do
    let(:actual_dsl) {
      <<-RUBY
create_table "parent", force: :cascade do |t|
end

create_table "child", force: :cascade do |t|
  t.integer "parent_id"
end

add_index "child", ["parent_id"], name: "par_id", using: :btree

add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
      RUBY
    }

    let(:sorted_actual_dsl) {
      <<-RUBY
create_table "child", force: :cascade do |t|
  t.integer "parent_id", limit: 4
end

add_index "child", ["parent_id"], name: "par_id", using: :btree

create_table "parent", force: :cascade do |t|
end

add_foreign_key "child", "parent", name: "child_ibfk_1", on_delete: :cascade
      RUBY
    }

    let(:expected_dsl) {
      <<-RUBY
create_table "child", force: :cascade do |t|
  t.integer "parent_id", limit: 4
end

add_index "child", ["parent_id"], name: "par_id", using: :btree

create_table "parent", force: :cascade do |t|
end

add_foreign_key "child", "parent", name: "child_ibfk_1"
      RUBY
    }

    before { subject.diff(actual_dsl).migrate }

    subject { client }

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump.delete_empty_lines).to eq sorted_actual_dsl.strip_heredoc.strip.delete_empty_lines
      delta.migrate
      expect(subject.dump.delete_empty_lines).to eq expected_dsl.strip_heredoc.strip.delete_empty_lines
    }
  end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ridgepole-0.6.4 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta9 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta8 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta7 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta6 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta5 spec/mysql/fk/migrate_change_fk_spec.rb
ridgepole-0.6.4.beta4 spec/mysql/fk/migrate_change_fk_spec.rb