diff --git a/db/migrate/20241107164046_create_ey_journey_configs.rb b/db/migrate/20241107164046_create_ey_journey_configs.rb new file mode 100644 index 0000000000..6b2745e7cc --- /dev/null +++ b/db/migrate/20241107164046_create_ey_journey_configs.rb @@ -0,0 +1,27 @@ +class CreateEyJourneyConfigs < ActiveRecord::Migration[7.0] + def up + [ + Journeys::EarlyYearsPayment::Provider::Start::ROUTING_NAME, + Journeys::EarlyYearsPayment::Provider::Authenticated::ROUTING_NAME, + Journeys::EarlyYearsPayment::Practitioner::ROUTING_NAME + ].reject do |routing_name| + Journeys::Configuration.exists?(routing_name: routing_name) + end.each do |routing_name| + Journeys::Configuration.create!( + routing_name: routing_name, + current_academic_year: AcademicYear.current, + open_for_submissions: false + ) + end + end + + def down + [ + Journeys::EarlyYearsPayment::Provider::Start::ROUTING_NAME, + Journeys::EarlyYearsPayment::Provider::Authenticated::ROUTING_NAME, + Journeys::EarlyYearsPayment::Practitioner::ROUTING_NAME + ].each do |routing_name| + Journeys::Configuration.find_by(routing_name: routing_name)&.destroy + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a6c43d4ed..a8c856cb8c 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: 2024_10_30_153139) do +ActiveRecord::Schema[7.0].define(version: 2024_11_07_164046) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "pg_trgm"