Skip to content

Database schema & migration #4

@thaninbew

Description

@thaninbew

Summary:

Create the Donation TypeORM entity and a reversible migration that creates the donations table. Wire the entity into the data source configuration.

Files to create:

  • apps/backend/src/donations/donation.entity.ts (new)
  • apps/backend/src/migrations/<timestamp>-add_donations.ts (new)
  • apps/backend/src/data-source.ts (update to include entity and migration pattern, also update migration path ending to *.ts instead of *.js)

Acceptance criteria:

  • Donation entity fields: id (PK serial), firstName, lastName, email, amount (numeric(10,2)), isAnonymous (boolean default false), donationType (enum: one_time | recurring), recurringInterval (nullable string "monthly" "yearly" "weekly" "bimonthly" "biweekly" ), dedicationMessage (nullable text), createdAt, updatedAt.
  • Migration creates donations table in up() and drops it in down().
  • data-source.ts includes Donation in entities and sets migrations pattern to apps/backend/src/migrations/*.ts.
  • Running yarn docker:migrate:dev applies the migration; yarn docker:migrate:revert rolls it back.

Testing steps:

  1. Start dev stack: yarn docker:up:dev
  2. Run migration: yarn docker:migrate:dev
  3. Check DB
  4. Revert migration: yarn docker:migrate:revert

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions