Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIMS-408 Establish Migration Options #2164

Merged
merged 7 commits into from
Feb 3, 2024

Conversation

dbarkowsky
Copy link
Collaborator

🎯 Summary

PIMS-408

Changes

  • Added commands to the package.json to access typeorm and the migration commands.
  • Added a script that handles some migration command options, allowing users to specify migration names.

Note: This will create a migrations table in Postgres. This is how TypeORM knows which migrations to run.

Testing

Works best if you have an empty database (generates migration to create all tables), but could be done by just editing an entity and running the commands.

Recommend running the commands and seeing the results.

Commands Added

  • npm run migration create <migrationName> - Creates a blank migration file.
  • npm run migration generate <migrationName> - Generates the migration file needed to sync the database to your entity files.
  • npm run migration run - Executes outstanding migrations.
  • npm run migration revert - Rolls back the most recent migration.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link
Collaborator

@TaylorFries TaylorFries left a comment

Choose a reason for hiding this comment

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

New commands run as expected.

Copy link

codeclimate bot commented Feb 3, 2024

Code Climate has analyzed commit df78d3d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 91.2%.

View more on Code Climate.

@dbarkowsky dbarkowsky merged commit 0526c90 into main Feb 3, 2024
3 checks passed
@dbarkowsky dbarkowsky deleted the PIMS-408-Establish-Migration-Options branch February 3, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants