Create Migration Error


We are trying to use sql server as a n8n database for poc. I added necessary configurations for sql server. When i try to create migration files i got “Cannot use import statement outside a module” error.
Can you please help me? How can i create migration files?

Ps: I dont have much node.js and typeorm knowledge, just wanted to know if we can run n8n with sql server.

Migration create command: typeorm migration:generate …/src/databases/migrations/sqlserver -d Db.ts

Error: "Cannot use import statement outside a module

Information on your n8n setup

  • n8n version: Latest master branch (07.12.2022)
  • Running n8n with the execution process [own(default)]:**
  • Running n8n via [npm]:**


I also tried " pnpm typeorm migration:generate -d …/src/databases/migrations/sqlserver -n InitMigration -c ./Db.ts" but it returned TypeORMError: No connection options were found in any orm configuration files. I assume its expect datasourse but “pnpm typeorm migration:generate” command don’t have any input as “Datasource”.

Hi @Mustafa_fimple, welcome to the community!

There currently is no support for MS SQL Server as a backend database for n8n I am afraid, and we occasionally observe database-specific problems that require changing the product logic (this one for example). So, I’d very recommend using one of the databases supported by n8n out of the box to avoid running into additional problems down the line.

If you want to stick with SQL Server, perhaps @ivov has some suggestions on where to start when it comes to the migrations? From checking the recent PRs it seems he has worked a lot on the existing ones.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.