Remove NULL possibility from customer flag

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.
This commit is contained in:
Maikel Linke
2023-06-15 12:00:53 +10:00
parent 75cce8bc19
commit a46917a7b7
3 changed files with 6 additions and 8 deletions

View File

@@ -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

View File

@@ -1,5 +0,0 @@
class AddIndexToCustomers < ActiveRecord::Migration[7.0]
def change
add_index :customers, :created_manually
end
end

View File

@@ -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"
@@ -93,7 +93,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_31_010957) do
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"