12 Added notes and colours to customers

This commit is contained in:
2025-07-23 15:35:19 +02:00
parent 84d43f0dac
commit 541b181c87
17 changed files with 362 additions and 20 deletions

View File

@@ -0,0 +1,5 @@
class AddColorToCustomers < ActiveRecord::Migration[7.1]
def change
add_column :customers, :color, :string
end
end

View File

@@ -0,0 +1,9 @@
class UpdateExistingCustomersColor < ActiveRecord::Migration[7.1]
def up
Customer.where(color: nil).update_all(color: 'green')
end
def down
# No rollback needed - we don't want to set colors back to nil
end
end

3
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2025_02_18_071800) do
ActiveRecord::Schema[7.1].define(version: 2025_07_04_092438) do
create_table "companies", force: :cascade do |t|
t.string "name"
t.string "id_number"
@@ -36,6 +36,7 @@ ActiveRecord::Schema[7.1].define(version: 2025_02_18_071800) do
t.string "first_name"
t.string "surname", null: false
t.string "original_phone", null: false
t.string "color"
t.index ["company_id"], name: "index_customers_on_company_id"
t.index ["first_name", "surname", "original_phone", "company_id"], name: "index_customers_on_composite_key_and_company", unique: true
t.index ["first_name", "surname", "original_phone"], name: "index_customers_on_composite_key", unique: true