Skip to content

Commit

Permalink
Merge branch 'fix/seed-data' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
tvcam committed Aug 25, 2023
2 parents 667eb1f + 0d0ae76 commit a9a8826
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/workers/organization_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ def perform(org_id)
organization = Organization.find(org_id)

Apartment::Tenant.create(organization.short_name)
organisation.update(onboarding_status: 'seeding_default_data')

Organization.seed_generic_data(organization.id, organization.referral_source_category_name)
organisation.update(onboarding_status: 'completed')
end
end
8 changes: 8 additions & 0 deletions db/migrate/20230825075054_add_onboarding_to_organizations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddOnboardingToOrganizations < ActiveRecord::Migration
def change
add_column :organizations, :onboarding_status, :string, default: 'pending'

current = Apartment::Tenant.current
Organization.where(short_name: current).update_all(onboarding_status: 'completed')
end
end
5 changes: 4 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20230823121242) do
ActiveRecord::Schema.define(version: 20230825075054) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -171,6 +171,7 @@
add_index "assessments", ["default"], name: "index_assessments_on_default", where: "(\"default\" = true)", using: :btree
add_index "assessments", ["default"], name: "index_assessments_on_default_false", where: "(\"default\" = false)", using: :btree
add_index "assessments", ["family_id"], name: "index_assessments_on_family_id", using: :btree
add_index "assessments", ["last_auto_save_at", "draft"], name: "index_assessments_on_last_auto_save_at_and_draft", using: :btree
add_index "assessments", ["level_of_risk"], name: "index_assessments_on_level_of_risk", using: :btree

create_table "attachments", force: :cascade do |t|
Expand Down Expand Up @@ -392,6 +393,7 @@
add_index "case_notes", ["client_id"], name: "index_case_notes_on_client_id", using: :btree
add_index "case_notes", ["custom_assessment_setting_id"], name: "index_case_notes_on_custom_assessment_setting_id", using: :btree
add_index "case_notes", ["family_id"], name: "index_case_notes_on_family_id", using: :btree
add_index "case_notes", ["last_auto_save_at", "draft"], name: "index_case_notes_on_last_auto_save_at_and_draft", using: :btree

create_table "case_worker_clients", force: :cascade do |t|
t.integer "user_id"
Expand Down Expand Up @@ -1904,6 +1906,7 @@
t.integer "referred_count", default: 0
t.integer "exited_client", default: 0
t.datetime "deleted_at"
t.string "onboarding_status", default: "pending"
end

add_index "organizations", ["deleted_at"], name: "index_organizations_on_deleted_at", using: :btree
Expand Down

0 comments on commit a9a8826

Please sign in to comment.