Skip to content

Instantly share code, notes, and snippets.

@doolin
Created December 22, 2022 14:10
Show Gist options
  • Save doolin/ef33e312d40b98c77d6a9214600fcf03 to your computer and use it in GitHub Desktop.
Save doolin/ef33e312d40b98c77d6a9214600fcf03 to your computer and use it in GitHub Desktop.

Revisions

  1. doolin created this gist Dec 22, 2022.
    9 changes: 9 additions & 0 deletions order_table_constraint.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    class Orders < ActiveRecord::Migration[7.0]
    def change
    create_table :orders do |t|
    t.string :first_name # use Rails validations
    t.string :last_name, null: false, limit: 128
    end
    end
    end
    Orders.migrate(:up) unless Orders.data_source_exists?(:orders)