Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run migration when using docker #1467

Closed
LadIQe opened this issue Feb 21, 2021 · 1 comment
Closed

How to run migration when using docker #1467

LadIQe opened this issue Feb 21, 2021 · 1 comment

Comments

@LadIQe
Copy link

LadIQe commented Feb 21, 2021

Hello,

I moved from TypeORM to Mikro-ORM for brighter future, but now Im regretting it. I have docker config, where I have 2 services, one for db, one for server.

I already figured out how to properly set configs for initializations and for CLI. But, migrations are not working at all. When I type

migration:create -i

there is table for migrations, but when I type

migration:create

there is no actual table for it, even migration table has no data about it. I have migration file in my project, but thats all. Also, I can run several times "create" command without any issue.

Migration list is empty, but migration pending has record about my migration. How to solve it? For what purpose is pending list?

Thank you

@B4nan
Copy link
Member

B4nan commented Feb 21, 2021

Sounds like you are confusing migrations with schema generator. migration create will create the migration file (containing the diff from the schema generator) - it will not execute anything. You need to call migration up for that (which will execute all pending migrations).

Also note that you don't need initial migration usually - that flag is only when you already have a schema and want to start using migrations. It will create the initial migration (again, just a file), and mark it as executed (if you have a schema).

https://mikro-orm.io/docs/migrations/
https://mikro-orm.io/docs/schema-generator

@B4nan B4nan closed this as completed Feb 21, 2021
@mikro-orm mikro-orm locked and limited conversation to collaborators Feb 21, 2021
@mikro-orm mikro-orm unlocked this conversation Feb 21, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants