Skip to content

Conversation

@rudiejd
Copy link
Member

@rudiejd rudiejd commented Jan 21, 2026

Summary of changes

Asana Ticket: 🏹🚆 Edit Trainsformer service schedules section
image

Adds the ability to edit the dates / days of week for which a Trainsformer export should be active! I also made a bunch of styling changes, some in concert with Benji.

Reviewer Checklist

  • Meets ticket's acceptance criteria
  • Any new or changed functions have typespecs
  • Tests were added for any new functionality (don't just rely on Codecov)
  • This branch was deployed to the staging environment and is currently running with no unexpected increase in warnings, and no errors or crashes.

@rudiejd rudiejd force-pushed the feat/edit-trainsformer-export branch from 467cc94 to bbd573e Compare January 21, 2026 14:07
@rudiejd rudiejd changed the title Feat/edit trainsformer export feat(trainsformer): edit trainsformer export Jan 21, 2026
@rudiejd rudiejd force-pushed the feat/edit-trainsformer-export branch from c0b4781 to 82cd807 Compare January 22, 2026 16:55
@rudiejd rudiejd marked this pull request as ready for review January 22, 2026 17:01
@rudiejd rudiejd requested a review from a team as a code owner January 22, 2026 17:01
@rudiejd rudiejd requested review from khansen-mbta and removed request for a team January 22, 2026 17:01
@rudiejd rudiejd force-pushed the feat/edit-trainsformer-export branch from 8ed3324 to 5a02235 Compare January 22, 2026 18:01
@rudiejd rudiejd requested a review from firestack January 22, 2026 20:04
belongs_to :service, Arrow.Trainsformer.Service, on_replace: :delete

has_many :service_date_days_of_week, ServiceDateDayOfWeek,
on_delete: :delete_all,
Copy link
Member

@firestack firestack Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I'm wondering if we should specify on_delete?
the docs say

Using this option is DISCOURAGED for most relational databases. Instead, in your migration, set references(:parent_id, on_delete: :delete_all).

https://hexdocs.pm/ecto/3.13.5/Ecto.Schema.html#has_many/3

And you already have on_delete specified in the migration.

def change do
create table(:service_date_days_of_week) do
add :day_name, :integer, null: false
add :service_date_id, references(:trainsformer_service_dates, on_delete: :delete_all)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I usually rely on Excellent Migrations for help here, but I'm wondering if we should specify the on_update behavior in this?

Comment on lines +7 to +8
add :service_date_id, references(:trainsformer_service_dates, on_delete: :delete_all)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: consider enabling constraint validation? https://hexdocs.pm/excellent_migrations/readme.html#adding-a-reference-or-foreign-key

(we should probably just add excellent_migrations lol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants