Sha256: a697b29a04e0b990727654eac3fbec7f29294a14522bde48105d41a2b3a24d09

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

describe 'Ridgepole::Client#diff -> migrate', condition: '>= 5.1.0' do
  context 'when change virtual column' do
    let(:actual_dsl) do
      <<-RUBY
        create_table "books", force: :cascade do |t|
          t.string   "title"
          t.virtual "upper_title", type: :string, null: false, as: "upper(`title`)"
          t.virtual "title_length", type: :integer, null: false, as: "length(`title`)", stored: true
          t.index ["title"], name: "index_books_on_title"
          t.index ["title_length"], name: "index_books_on_title_length"
        end
      RUBY
    end

    let(:expected_dsl) do
      <<-RUBY
        create_table "books", force: :cascade do |t|
          t.string   "title"
          t.virtual "upper_title", type: :string, null: false, as: "length(`title`)"
          t.virtual "title_length", type: :integer, null: false, as: "upper(`title`)", stored: true
          t.index ["title"], name: "index_books_on_title"
          t.index ["title_length"], name: "index_books_on_title_length"
        end
      RUBY
    end

    before { subject.diff(actual_dsl).migrate }
    subject { client }

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump).to match_ruby actual_dsl
      delta.migrate
      expect(subject.dump).to match_ruby expected_dsl
    }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ridgepole-0.8.0.rc1 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.7 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.6 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.5 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.5.beta3 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.5.beta2 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.5.beta spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.4 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.3 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.3.beta3 spec/mysql57/virtual/change_virtual_column_spec.rb
ridgepole-0.7.3.beta2 spec/mysql57/virtual/change_virtual_column_spec.rb