Skip to content

Commit

Permalink
Remove NULL possibility from customer flag
Browse files Browse the repository at this point in the history
It should only be true or false. This was flagged by Rubocop. I also
added another Rubocop suggestion and combined two migrations because
they are related.
  • Loading branch information
mkllnk committed Jun 15, 2023
1 parent 75cce8b commit a46917a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# frozen_string_literal: true

class AddCreatedManuallyFlagToCustomer < ActiveRecord::Migration[7.0]
def change
add_column :customers, :created_manually, :boolean, default: false
add_column :customers, :created_manually, :boolean, null: false, default: false
add_index :customers, :created_manually
end
end
5 changes: 0 additions & 5 deletions db/migrate/20230531010957_add_index_to_customers.rb

This file was deleted.

4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_05_31_010957) do
ActiveRecord::Schema[7.0].define(version: 2023_06_05_133804) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
Expand Down Expand Up @@ -93,7 +93,7 @@
t.datetime "terms_and_conditions_accepted_at", precision: nil
t.string "first_name", default: "", null: false
t.string "last_name", default: "", null: false
t.boolean "created_manually", default: false
t.boolean "created_manually", default: false, null: false
t.index ["bill_address_id"], name: "index_customers_on_bill_address_id"
t.index ["created_manually"], name: "index_customers_on_created_manually"
t.index ["email"], name: "index_customers_on_email"
Expand Down

0 comments on commit a46917a

Please sign in to comment.