From a46917a7b7b36d9d16df6094dbb5b95d88c0e1f9 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 15 Jun 2023 12:00:53 +1000 Subject: [PATCH] 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. --- .../20230516072511_add_created_manually_flag_to_customer.rb | 5 ++++- db/migrate/20230531010957_add_index_to_customers.rb | 5 ----- db/schema.rb | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 db/migrate/20230531010957_add_index_to_customers.rb diff --git a/db/migrate/20230516072511_add_created_manually_flag_to_customer.rb b/db/migrate/20230516072511_add_created_manually_flag_to_customer.rb index 90b9dbac60..886650ef79 100644 --- a/db/migrate/20230516072511_add_created_manually_flag_to_customer.rb +++ b/db/migrate/20230516072511_add_created_manually_flag_to_customer.rb @@ -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 diff --git a/db/migrate/20230531010957_add_index_to_customers.rb b/db/migrate/20230531010957_add_index_to_customers.rb deleted file mode 100644 index c17c034c42..0000000000 --- a/db/migrate/20230531010957_add_index_to_customers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexToCustomers < ActiveRecord::Migration[7.0] - def change - add_index :customers, :created_manually - end -end diff --git a/db/schema.rb b/db/schema.rb index 0521b61047..c7bc88e74a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"