Sha256: 5ceca8366c2e3072f67969d9c14a30db8aca8270a4d815e5417bb049c0a37b52

Contents?: true

Size: 1.34 KB

Versions: 21

Compression:

Stored size: 1.34 KB

Contents

# Copyright 2020 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

# frozen_string_literal: true

require "test_helper"

module ActiveRecord
  class Migration
    class ColumnPositioningTest < SpannerAdapter::TestCase
      include SpannerAdapter::Migration::TestHelper

      def setup
        skip_test_table_create!
        super

        connection.ddl_batch do
          connection.create_table :testing_columns_position, id: false, force: true do |t|
            t.column :first, :integer
            t.column :second, :integer
            t.column :third, :integer
          end
        end
      end

      def teardown
        connection.ddl_batch do
          connection.drop_table :testing_columns_position
        end rescue nil
        ActiveRecord::Base.primary_key_prefix_type = nil
      end

      def test_column_positioning
        assert_equal %w(first second third), connection.columns(:testing_columns_position).map(&:name)
      end

      def test_add_column_with_positioning
        connection.ddl_batch do
          connection.add_column :testing_columns_position, :fourth, :integer
        end
        assert_equal %w(first second third fourth), connection.columns(:testing_columns_position).map(&:name)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.6.3 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.6.2 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.6.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.6.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.5.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.5.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.4.4 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.4.3 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.4.2 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.4.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.4.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.3.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.2.2 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.2.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.2.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.1.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.0.1 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-1.0.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-0.7.0 acceptance/cases/migration/column_positioning_test.rb
activerecord-spanner-adapter-0.6.0 acceptance/cases/migration/column_positioning_test.rb