Browse Source

Add created_by

pull/2373/head
Kat 2 years ago
parent
commit
5574884456
  1. 1
      app/models/log.rb
  2. 11
      db/migrate/20240408102550_add_created_by.rb
  3. 6
      db/schema.rb

1
app/models/log.rb

@ -5,6 +5,7 @@ class Log < ApplicationRecord
belongs_to :owning_organisation, class_name: "Organisation", optional: true belongs_to :owning_organisation, class_name: "Organisation", optional: true
belongs_to :assigned_to, class_name: "User", optional: true belongs_to :assigned_to, class_name: "User", optional: true
belongs_to :created_by, class_name: "User", optional: true
belongs_to :updated_by, class_name: "User", optional: true belongs_to :updated_by, class_name: "User", optional: true
belongs_to :bulk_upload, optional: true belongs_to :bulk_upload, optional: true

11
db/migrate/20240408102550_add_created_by.rb

@ -0,0 +1,11 @@
class AddCreatedBy < ActiveRecord::Migration[7.0]
def change
change_table :sales_logs do |t|
t.references :created_by, class_name: "User"
end
change_table :lettings_logs do |t|
t.references :created_by, class_name: "User"
end
end
end

6
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_04_08_101139) do ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -320,8 +320,10 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_101139) do
t.integer "partner_under_16_value_check" t.integer "partner_under_16_value_check"
t.integer "multiple_partners_value_check" t.integer "multiple_partners_value_check"
t.bigint "assigned_to_id" t.bigint "assigned_to_id"
t.bigint "created_by_id"
t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id" t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id"
t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id"
t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id"
t.index ["location_id"], name: "index_lettings_logs_on_location_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id"
t.index ["managing_organisation_id"], name: "index_lettings_logs_on_managing_organisation_id" t.index ["managing_organisation_id"], name: "index_lettings_logs_on_managing_organisation_id"
t.index ["old_id"], name: "index_lettings_logs_on_old_id", unique: true t.index ["old_id"], name: "index_lettings_logs_on_old_id", unique: true
@ -686,8 +688,10 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_101139) do
t.integer "partner_under_16_value_check" t.integer "partner_under_16_value_check"
t.integer "multiple_partners_value_check" t.integer "multiple_partners_value_check"
t.bigint "assigned_to_id" t.bigint "assigned_to_id"
t.bigint "created_by_id"
t.index ["assigned_to_id"], name: "index_sales_logs_on_assigned_to_id" t.index ["assigned_to_id"], name: "index_sales_logs_on_assigned_to_id"
t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id" t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id"
t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id"
t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id"
t.index ["old_id"], name: "index_sales_logs_on_old_id", unique: true t.index ["old_id"], name: "index_sales_logs_on_old_id", unique: true
t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"

Loading…
Cancel
Save