R
Railway5mo ago
Faith

Typeorm migration run

"start": "sleep 3 && tsc && pnpm run sync && pnpm run migrate:run && node ./build/index.js",
"sync": "pnpm typeorm migration:generate /app/build/migration/Init -o -d /app/build/data-source.js",
"migrate:run": "pnpm typeorm migration:run -d /app/build/data-source.js",
"typeorm": "npx typeorm-ts-node-commonjs",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org define-waters --project node-express ./build && sentry-cli sourcemaps upload --org define-waters --project node-express ./build"
"start": "sleep 3 && tsc && pnpm run sync && pnpm run migrate:run && node ./build/index.js",
"sync": "pnpm typeorm migration:generate /app/build/migration/Init -o -d /app/build/data-source.js",
"migrate:run": "pnpm typeorm migration:run -d /app/build/data-source.js",
"typeorm": "npx typeorm-ts-node-commonjs",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org define-waters --project node-express ./build && sentry-cli sourcemaps upload --org define-waters --project node-express ./build"
hey guys i hvae this issue with when my migrations are being synced/generated it some how fails and wont run due to there no migration being generated ( which is okay, dont make if cant find ) but for some reason when it hits the migration:run the app starts over from zero again -.-
Solution:
change the && to a semicolon after the command that is exiting with 1 instead of 0
Jump to solution
23 Replies
Percy
Percy5mo ago
Project ID: 51cb3e5e-013d-43eb-b545-600daa26b09f
Faith
FaithOP5mo ago
51cb3e5e-013d-43eb-b545-600daa26b09f
Faith
FaithOP5mo ago
No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command`
No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command`
this is the eye catchin part ^^ also this
INFO: All classes found using provided glob pattern "/app/build/entity/*.js" : "/app/build/entity/Addresser.js,/app/build/entity/Admin.js,/app/build/entity/BookeableItem.js,/app/build/entity/Bookings.js,/app/build/entity/Category.js,/app/build/entity/CategoryItem.js,/app/build/entity/CouponCode.js,/app/build/entity/CouponItem.js,/app/build/entity/Coupons.js,/app/build/entity/Order.js,/app/build/entity/Reciepts.js,/app/build/entity/ServiceBookable.js,/app/build/entity/ServiceBooking.js,/app/build/entity/Users.js"

INFO: No classes were found using the provided glob pattern: "/app/build/migration/*.js"
INFO: All classes found using provided glob pattern "/app/build/entity/*.js" : "/app/build/entity/Addresser.js,/app/build/entity/Admin.js,/app/build/entity/BookeableItem.js,/app/build/entity/Bookings.js,/app/build/entity/Category.js,/app/build/entity/CategoryItem.js,/app/build/entity/CouponCode.js,/app/build/entity/CouponItem.js,/app/build/entity/Coupons.js,/app/build/entity/Order.js,/app/build/entity/Reciepts.js,/app/build/entity/ServiceBookable.js,/app/build/entity/ServiceBooking.js,/app/build/entity/Users.js"

INFO: No classes were found using the provided glob pattern: "/app/build/migration/*.js"
it finds the entites no problem but then ofc no migrations are suppose to be found since it up to date which is fine
Solution
Brody
Brody5mo ago
change the && to a semicolon after the command that is exiting with 1 instead of 0
Faith
FaithOP5mo ago
pnpm run sync, pnpm run migrate:run
pnpm run sync, pnpm run migrate:run
` like this?
Brody
Brody5mo ago
that's not a semicolon
Faith
FaithOP5mo ago
sorry ahhahahaahah "start": "sleep 3 && tsc && pnpm run sync; pnpm run migrate:run && pnpm sentry:sourcemaps && node ./build/index.js", OH AFTER sorry
Brody
Brody5mo ago
yep
Faith
FaithOP5mo ago
"start": "sleep 3 && tsc && pnpm run sync && pnpm run migrate:run; pnpm sentry:sourcemaps && node ./build/index.js",
"start": "sleep 3 && tsc && pnpm run sync && pnpm run migrate:run; pnpm sentry:sourcemaps && node ./build/index.js",
Brody
Brody5mo ago
that's just a quick work around, the correct solution would be to have the migration command exit with 0 if there are no migrations to run
Faith
FaithOP5mo ago
how would i do that
Brody
Brody5mo ago
that would kinda be out of scope as it wouldn't have anything to do with the platform or running your app on the platform I'm sure you could find some information about what I've said, I'm just trying to get you running and then point you in the correct direction
Faith
FaithOP5mo ago
my man let me se if it works nope still failing to launch
Brody
Brody5mo ago
deploy logs please
Faith
FaithOP5mo ago
shall i do same for sync maybe
Brody
Brody5mo ago
give it a try
Faith
FaithOP5mo ago
ye just did its deploying
Brody
Brody5mo ago
this, I replied to the wrong message
Faith
FaithOP5mo ago
works!!! thanks
Brody
Brody5mo ago
no problem!
Want results from more Discord servers?
Add your server