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

BC-5936 - replace migration library #4680

Merged
merged 29 commits into from
Jan 29, 2024
Merged

Conversation

virgilchiriac
Copy link
Contributor

@virgilchiriac virgilchiriac commented Jan 5, 2024

Description

  • remove mongoose-migrate and install miko-orm/migration
  • remove old migrations. One migration created since last release was coverted into mikro-orm migration
  • implement new console command to execute migration up / down on the built js, not ts (used for CI)
  • adjust package.json database seed command
  • update mikro-orm to 5.6.8 because of migration bug on windows
  • add memory limit to jest workers, to avoid leaks leading to out to memory error

Links to Tickets or other pull requests

BC-5936

hpi-schul-cloud/schulcloud-documentation#20

Changes

  • npm run setup - was removed. You should use instead npm run setup:db:seed
  • npm run migration up was removed. Instead, on local env you should use npx mikro-orm migration:up while on CI npm run migration:up (runs only on the build js files)
  • migrations are now stored in apps/server/src/migrations/mikro-orm

Datasecurity

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

@virgilchiriac virgilchiriac added the WIP This feature branch is in progress, do not merge into master. label Jan 5, 2024
@virgilchiriac virgilchiriac self-assigned this Jan 5, 2024
@virgilchiriac virgilchiriac force-pushed the BC-5936-switch-migration-lib branch 5 times, most recently from 08cfd22 to cb50bb3 Compare January 5, 2024 18:16
@virgilchiriac virgilchiriac force-pushed the BC-5936-switch-migration-lib branch from cb50bb3 to eadee51 Compare January 5, 2024 18:38
@virgilchiriac virgilchiriac force-pushed the BC-5936-switch-migration-lib branch from 2abdbc1 to efe9073 Compare January 8, 2024 09:23
@virgilchiriac virgilchiriac removed the WIP This feature branch is in progress, do not merge into master. label Jan 8, 2024
@virgilchiriac virgilchiriac changed the title BC-5963 - replace migration library BC-5936 - replace migration library Jan 8, 2024
path: './dist/apps/server/src/migrations/mikro-orm', // path to the folder with migrations
pathTs: './apps/server/src/migrations/mikro-orm', // path to the folder with TS migrations (if used, we should put path to compiled files in `path`)
glob: '!(*.d).{js,ts}', // how to match migration files (all .js and .ts files, but not .d.ts)
transactional: false, // wrap each migration in a transaction
Copy link
Contributor Author

Choose a reason for hiding this comment

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

transations need MongoBD replica - local / dev cluster does not work
perhaps TODO for staging / prod

@virgilchiriac virgilchiriac force-pushed the BC-5936-switch-migration-lib branch 2 times, most recently from 5e36500 to 140883c Compare January 8, 2024 13:57
for console mikroorm config findOneOrFailHandler
@virgilchiriac virgilchiriac force-pushed the BC-5936-switch-migration-lib branch from f5e982b to 4668d0d Compare January 8, 2024 16:13
package.json Outdated Show resolved Hide resolved
apps/server/src/mikro-orm.config.ts Outdated Show resolved Hide resolved
apps/server/src/mikro-orm.config.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@SevenWaysDP SevenWaysDP left a comment

Choose a reason for hiding this comment

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

@virgilchiriac can you please replace strings in [mikro-orm-cli.config.ts] with my example

const pathToMigrations = resolve(__dirname, '..', 'migrations', 'mikro-orm');

{
...
	path: pathToMigrations, // path to the folder with migrations
	pathTs: pathToMigrations, // path to the folder with TS migrations (if used, we should put path to compiled files in `path`)
...
}

@virgilchiriac virgilchiriac enabled auto-merge (squash) January 18, 2024 07:32
Copy link

@virgilchiriac virgilchiriac merged commit 53c02d8 into main Jan 29, 2024
47 checks passed
@virgilchiriac virgilchiriac deleted the BC-5936-switch-migration-lib branch January 29, 2024 11:48
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