Sha256: 27cd78cfea18cd2f6d1f64b37f9ecfa0f08abad23bf911d463c277d46e434b73

Contents?: true

Size: 370 Bytes

Versions: 8

Compression:

Stored size: 370 Bytes

Contents

class CreatePosts < ActiveRecord::Migration[5.0]
  def change
    create_table :posts do |t|
      t.string :title
      t.string :body
      t.belongs_to :author, foreign_key: {
        to_table: :users,
        column: :author_id,
        name: :posts_author_fk,
        on_delete: :cascade,
        on_update: :restrict,
      }

      t.timestamps
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sapience-1.0.11 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.10 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.9 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.8 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.7 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.6 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.5 test_apps/rails/db/migrate/20160902141445_create_posts.rb
sapience-1.0.4 test_apps/rails/db/migrate/20160902141445_create_posts.rb