12 Added notes and colours to customers
This commit is contained in:
5
db/migrate/20250704091649_add_color_to_customers.rb
Normal file
5
db/migrate/20250704091649_add_color_to_customers.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddColorToCustomers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :customers, :color, :string
|
||||
end
|
||||
end
|
||||
@@ -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
3
db/schema.rb
generated
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user