Sha256: 336ec8969af9823f05607544781897d7af9d8795e49f0a64e3b7d09a2660f8db

Contents?: true

Size: 820 Bytes

Versions: 21

Compression:

Stored size: 820 Bytes

Contents

# Copyright 2021 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.

class CreateTables < ActiveRecord::Migration[6.0]
  def change
    connection.ddl_batch do
      create_table :singers do |t|
        t.string :first_name
        t.string :last_name
        # `lock_version` is the default name for an optimistic lock version column in ActiveRecord.
        t.integer :lock_version
      end

      create_table :albums do |t|
        t.string :title
        t.numeric :marketing_budget
        t.references :singer, index: false, foreign_key: true
        # `lock_version` is the default name for an optimistic lock version column in ActiveRecord.
        t.integer :lock_version
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.6.3 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.6.2 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.6.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.6.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.5.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.5.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.4.4 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.4.3 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.4.2 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.4.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.4.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.3.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.2.2 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.2.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.2.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.1.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.0.1 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-1.0.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-0.7.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb
activerecord-spanner-adapter-0.6.0 examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb