Skip to content
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

Why migration:run throws error in production environment? #10

Closed
Leko opened this issue Jan 3, 2016 · 4 comments
Closed

Why migration:run throws error in production environment? #10

Leko opened this issue Jan 3, 2016 · 4 comments
Assignees

Comments

@Leko
Copy link

Leko commented Jan 3, 2016

Hi there.

I think that migration should be the same on the production and development environment.
It is better approach to keep same schema definition between production and development.

But ./ace migration:run throws exception on NODE_ENV=production without --force flag.

https://github.com/adonisjs/adonis-lucid/blob/master/src/Commands/Run.js#L33

Why throws error in production environment?

Sorry for my English.

@thetutlage
Copy link
Member

True, it is not safe to run migrations in production, as migrations can override data in your existing tables. Ace disables it by default and if you are sure that you want to run migrations than you can always use the --force flag

@Leko
Copy link
Author

Leko commented Jan 3, 2016

@thetutlage Thank you for your prompt response.

Please tell me good practice on production.

  • Use --force flag? (not safe)
  • Run the SQL(eg. CREATE TABLE ..., ALTER TABLE ...) manually?
  • Something else?

@thetutlage
Copy link
Member

Use the force flag, there is nothing wrong with it. It is there to make sure you are not running migration:run by mistake, which may end up in loosing important data. As long as you know what you are doing you can use --force and it's all good.

@Leko
Copy link
Author

Leko commented Jan 3, 2016

@thetutlage Thank you!

@thetutlage thetutlage self-assigned this Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants