Self-hosted on AWS ECS, problem with db:migrate

I deployed Retool on AWS ECS Fargate, and have problem with database migration. There is a log after first run:

There are pending database migrations, checking for up-to-date schema in 1 second(s)...
-     EXITING RETOOL      -
There are 233 pending database migrations. Retool will not start
unless all database migrations have been run.
To run migrate the database, run the following command:
    yarn sequelize db:migrate

So I ran that command, and there is an error:

yarn sequelize db:migrate
yarn run v1.22.5
$ ./node_modules/.bin/sequelize --config "$(test -d 'transpiled' && echo './transpiled' || echo '.')/server/config/config.js" db:migrate

Sequelize CLI [Node: 12.22.5, CLI: 5.5.0, ORM: 5.22.3]

[process service types] [ 'MAIN_BACKEND', 'DB_CONNECTOR' ]
Loaded configuration file "server/config/config.js".
Using environment "production".
== 20210902174420-add_page_save_playground_query_saves_playground_query_id_idx: migrating =======

ERROR: Cannot find module '../db/indexManagement'
Require stack:
- /retool_backend/migrations/20210902174420-add_page_save_playground_query_saves_playground_query_id_idx.js
- /retool_backend/node_modules/umzug/lib/migration.js
- /retool_backend/node_modules/umzug/lib/index.js
- /retool_backend/node_modules/sequelize-cli/lib/core/migrator.js
- /retool_backend/node_modules/sequelize-cli/lib/commands/migrate.js
- /retool_backend/node_modules/sequelize-cli/lib/sequelize

error Command failed with exit code 1.
info Visit for documentation about this command.

What can I do now?

After running ./retool_backend --migrations-only migration passed successfully.

How did you run this command ./retool_backend --migrations-only?

I have retool installed on AWS ECS fargate. I am facing the same issue "There are pending database migrations" while trying to upgrade retool. I think, I need to run the above command to fix the issue. Please advise how did you execute it?

Hey Karthikeyan!\

Just saw this thread and wanted to make sure you were unblocked. Would you mind sharing your container logs here?

And it sounds like a migrations issue, so you can try running yarn sequelize db:migrate to force the migrations to run again.

If this doesn't work, I'd be curious to know which specific migration(s) are failing.

Let me know!

  1. Add IAM policy to task IAM role
    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Statement1",
            "Effect": "Allow",
            "Action": [
            "Resource": [
  1. Enable execute-command for ECS Service
aws ecs update-service --enable-execute-command --cluster <CLUSTER_ID> --service <SERVICE_ARN>
  1. Using AWS CloudShell run this commands
aws ecs execute-command --cluster <CLUSTER_ID> --task <TASK_ARN> --command "/bin/sh" --interactive
su retool_user
./retool_backend --migrations-only
1 Like