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 https://docs.n8n.io/reference/data/database.html#sqlite

1 Like

And a good tool to use to access it would be https://dbeaver.io/

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: https://typeorm.io/#/migrations/creating-a-new-migration

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.