Alter the Sqlite DB

Hi there,
First of all: Thanks for this wonderful projects.

My question is: How can I alter the sqlite DB? I want to add a new column to Workflow table. I’ve seen a few migration files, but changing them would not change the DB itself. Also I did change the WorkflowEntity.ts as well as some interfaces.

PS: Where is the sqlite file itself? my OS is windows.

Thanks in advance.

@jellybean welcome to the community.

The SQLite DB can be found Databases | Docs

1 Like

And a good tool to use to access it would be

1 Like

Thanks for the answers.

Should I change the DB by changing the sqlite file itself? Or is there any way to do it by migration files?

Not sure what exactly you have planned and who or what would use that data but the cleanest thing would be to create a new migration file. Editing an existing one would not change anything as those migrations did already run so they will never run again. Only if you create a new migration will it run (and also run it only once) and so make the changes.

1 Like

Thanks @jan for the answer.
I just want to add a new column to Workflow table.
So migration file would run automatically or I must run it ?

Also, is it good for learning migration: TypeORM - Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

Thanks you very much.

It would then run automatically the next time you start n8n as long as it got added in packages/cli/src/DB.ts

Yes exactly, that is a good thing to check out regarding migrations.

1 Like

Thank @jan , You are awesome.
You can close this topic.