Cannot execute migrations on server (NestJS)
18:55 17 Dec 2025

I have been trying to get my migrations to run but I can not get it to work. I have moved my migrations folder inside my src folder, but when I change the paths in the mikro-orm.config.js I can not execute the migrations. I used to execute the using the following command:

docker compose exec backend npx mikro-orm migration:up 

Right now it still says it has updated succesfully, but when I list the migrations executed, no new ones are in the list.

Listed below are my configuration files and some logging results. I have tried many options for the migrations path but nothing seems to work. Been at it for hours. If someone knows the issue, please let me know!!

backend$ docker compose exec backend ls dist/migrations
WARN[0000] /home/deployer/projects/formsight/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
Migration20251128214738.d.ts    Migration20251128220455.d.ts    Migration20251128221142.d.ts    Migration20251129091712.d.ts    Migration20251216184429.d.ts    Migration20251217192719.d.ts    Migration20251217193356.d.ts
Migration20251128214738.js      Migration20251128220455.js      Migration20251128221142.js      Migration20251129091712.js      Migration20251216184429.js      Migration20251217192719.js      Migration20251217193356.js
Migration20251128214738.js.map  Migration20251128220455.js.map  Migration20251128221142.js.map  Migration20251129091712.js.map  Migration20251216184429.js.map  Migration20251217192719.js.map  Migration20251217193356.js.map
backend$ docker compose exec backend ls src/migrations
WARN[0000] /home/deployer/projects/formsight/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
Migration20251128214738.ts  Migration20251128220455.ts  Migration20251128221142.ts  Migration20251129091712.ts  Migration20251216184429.ts  Migration20251217192719.ts  Migration20251217193356.ts
// mikro-orm.config.js

exports.default = (0, postgresql_1.defineConfig)({
    dbName: process.env.POSTGRES_DB,
    user: process.env.POSTGRES_USER,
    password: process.env.POSTGRES_PASSWORD,
    host: process.env.POSTGRES_HOST,
    port: Number(process.env.POSTGRES_PORT) || 5432,
    entities: ['./dist/**/*.entity.js'],
    entitiesTs: ['./src/**/*.entity.ts'],
    debug: process.env.NODE_ENV !== 'production',
    extensions: [seeder_1.SeedManager],
    seeder: {
        path: './dist/src',
        pathTs: './src',
        defaultSeeder: 'AppSeeder',
    },
    migrations: {
        path: './migrations',
        pathTs: './migrations',
    },
});
// nest-cli.json

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "entryFile": "main",
  "compilerOptions": {
    "tsConfigPath": "tsconfig.build.json",
    "outDir": "./dist",
    "deleteOutDir": true,
    "assets": ["**/*.hbs"],
    "watchAssets": true
  }
}

// tsconfig.build.json
{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "target": "ES2023",
    "declaration": true,
    "sourceMap": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noEmit": false,
    "skipLibCheck": true
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules", "test", "**/*.spec.ts"]
}
"scripts": {
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main.js",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json",
    "mikro-orm": "mikro-orm",
    "migration:create": "mikro-orm migration:create",
    "migration:up": "mikro-orm migration:up",
    "migration:down": "mikro-orm migration:down",
    "migration:list": "mikro-orm migration:list",
    "migration:reset": "mikro-orm migration:down --all && mikro-orm migration:up"
  },
typescript docker nestjs mikro-orm