After running migration successfully I can not access tables. I get the error table doesn’t exsit and have to reload about 3 time for the migration to work. I set up a fallback but my team want it to be ready on install
Hi,
After install, the event avi:forge:installed:app can take a couple of minutes to arrive. During that time, if the app tries to access the tables, it will throw errors.
Migrations can also be slow – some DDL take more than 3s, and if there are many, you can hit the ~55s invocation window.
One option could be to run migrations inside an @forge/async job (up to 15 min, with retries). It also helps if migrations are idempotent (IF EXISTS / IF NOT EXISTS), so retries don’t fail on partially applied changes.
Another idea is to only show the app after migrations finish – for example, set an app property (dbReady=true) once they succeed and use display conditions in the manifest to hide the app until it’s ready.
Hello,
Is this a recent change because my other apps use Forge/cli 12.4 would get access to the db immediately. I do need that same behavior so I can check access to the app on my table. So with this is there no way to make the app work? Or do i have to do one of the workarounds. Like now i am waiting for db to be ready which take about 30 to 50 seconds then continuing to my app but it is too slow
Also made sure my sql statements are idempotent.
thanks for your time Michael
Also I only have 8 tables
Hi Michael,
The DB itself is available right away – the delay comes from the avi:forge:installed:app event. Since migrations are often triggered from that event, they will naturally start a bit later.
If your migrations take 30–50 seconds, you’re already very close to the 55s invocation limit, so sometimes they can time out.
As another option, you could use a Get started page and trigger the migration there, showing the user a simple progress indicator while the schema is being set up:
This way the app feels responsive and users(admin) can see that setup is happening, rather than just hitting errors or long waits.
Alright that make since I think i am going to try creating a resolver that checks if db is available and if not immediately run the migration instead of waiting for install to run it also you have given me a lot of info and i really appreciate it. I will let you know if this works
didnt work can only get to work that way with a button