diff --git a/app/models/application_form.rb b/app/models/application_form.rb index 77ac8a4683..34cd2f0d1b 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -45,6 +45,7 @@ # requires_preliminary_check :boolean default(FALSE), not null # stage :string default("draft"), not null # status :string default("draft"), not null +# statuses :string default(["\"draft\""]), not null, is an Array # subjects :text default([]), not null, is an Array # subjects_status :string default("not_started"), not null # submitted_at :datetime diff --git a/config/analytics.yml b/config/analytics.yml index 2eba07d5dd..07e9a844e8 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -70,6 +70,7 @@ - reviewer_id - stage - status + - statuses - subjects - subjects_status - submitted_at diff --git a/db/migrate/20221025095046_add_statuses_to_application_forms.rb b/db/migrate/20221025095046_add_section_statuses_to_application_forms.rb similarity index 90% rename from db/migrate/20221025095046_add_statuses_to_application_forms.rb rename to db/migrate/20221025095046_add_section_statuses_to_application_forms.rb index 61bcb716c8..14aa04d5f6 100644 --- a/db/migrate/20221025095046_add_statuses_to_application_forms.rb +++ b/db/migrate/20221025095046_add_section_statuses_to_application_forms.rb @@ -1,4 +1,4 @@ -class AddStatusesToApplicationForms < ActiveRecord::Migration[7.0] +class AddSectionStatusesToApplicationForms < ActiveRecord::Migration[7.0] def change change_table :application_forms, bulk: true do |t| t.string :personal_information_status, default: "not_started", null: false diff --git a/db/migrate/20230914104107_add_statuses_to_application_forms.rb b/db/migrate/20230914104107_add_statuses_to_application_forms.rb new file mode 100644 index 0000000000..aa1974dd78 --- /dev/null +++ b/db/migrate/20230914104107_add_statuses_to_application_forms.rb @@ -0,0 +1,10 @@ +class AddStatusesToApplicationForms < ActiveRecord::Migration[7.0] + def change + add_column :application_forms, + :statuses, + :string, + default: %w[draft], + array: true, + null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 8620b61695..1fe8ddfc16 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_09_14_084340) do +ActiveRecord::Schema[7.0].define(version: 2023_09_14_104107) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -107,6 +107,7 @@ t.datetime "withdrawn_at" t.string "action_required_by", default: "none", null: false t.string "stage", default: "draft", null: false + t.string "statuses", default: ["draft"], null: false, array: true t.index ["action_required_by"], name: "index_application_forms_on_action_required_by" t.index ["assessor_id"], name: "index_application_forms_on_assessor_id" t.index ["english_language_provider_id"], name: "index_application_forms_on_english_language_provider_id" diff --git a/spec/factories/application_forms.rb b/spec/factories/application_forms.rb index b2023353ec..c6c41cef8d 100644 --- a/spec/factories/application_forms.rb +++ b/spec/factories/application_forms.rb @@ -45,6 +45,7 @@ # requires_preliminary_check :boolean default(FALSE), not null # stage :string default("draft"), not null # status :string default("draft"), not null +# statuses :string default(["\"draft\""]), not null, is an Array # subjects :text default([]), not null, is an Array # subjects_status :string default("not_started"), not null # submitted_at :datetime diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index ce0249496b..5336ce22d6 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -45,6 +45,7 @@ # requires_preliminary_check :boolean default(FALSE), not null # stage :string default("draft"), not null # status :string default("draft"), not null +# statuses :string default(["\"draft\""]), not null, is an Array # subjects :text default([]), not null, is an Array # subjects_status :string default("not_started"), not null # submitted_at :datetime