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

error: migration:run is not a registered comman #5

Open
barak-haviv opened this issue Mar 31, 2018 · 6 comments
Open

error: migration:run is not a registered comman #5

barak-haviv opened this issue Mar 31, 2018 · 6 comments

Comments

@barak-haviv
Copy link

I Got this after following the installation instruction.
node --version v8.10.0

@iamraphson
Copy link
Owner

@barak-haviv what is your node version?

@2peter3
Copy link

2peter3 commented Mar 31, 2018

same here,

adonis cli: 4.0.4
node: v9.10.1
npm: 5.6.0

on mac OS High Sierra - 10.13.2
Homebrew 1.5.13

@2peter3
Copy link

2peter3 commented Mar 31, 2018

@barak-haviv change
"version": "4.1",
to
"version": "4.1.5",

in package.json

and migration works, but with warnings...:
Knex:warning - Use async .hasTable to check if table exists and then use plain .createTable. Since .createTableIfNotExists actually just generates plain "CREATE TABLE IF NOT EXIST..." query it will not work correctly if there are any alter table queries generated for columns afterwards. To not break old migrations this function is left untouched for now, but it should not be used when writing new code and it is removed from documentation. Knex:warning - Use async .hasTable to check if table exists and then use plain .createTable. Since .createTableIfNotExists actually just generates plain "CREATE TABLE IF NOT EXIST..." query it will not work correctly if there are any alter table queries generated for columns afterwards. To not break old migrations this function is left untouched for now, but it should not be used when writing new code and it is removed from documentation. Knex:warning - Use async .hasTable to check if table exists and then use plain .createTable. Since .createTableIfNotExists actually just generates plain "CREATE TABLE IF NOT EXIST..." query it will not work correctly if there are any alter table queries generated for columns afterwards. To not break old migrations this function is left untouched for now, but it should not be used when writing new code and it is removed from documentation.

@iamraphson
Copy link
Owner

iamraphson commented Apr 1, 2018

@barak-haviv @2peter3 thanks. For the warnings, it's from a knex lib used by @adonisjs/lucid. i don't know the cause but an issue has been raised #4

@iamraphson
Copy link
Owner

@barak-haviv @2peter3 the warning is normal according to adonisjs/lucid#304 so I will close this issue.

@Maxximus007
Copy link

Maxximus007 commented Jun 28, 2018

@iamraphson It's probably better to do as recommended, change migrations to:
if (!this.hasTable('users')) { this.createTable('users', table => {
to prevent the warning message.

As a sidenote sqlite can't consume your alter table command, since it's not supporting alter.

Lastly, to be able to run it out of the box you might want to add "sqlite3": "^4.0.1", to package.json

**EDIT: createTable does not work anymore, it's create now. hasTable is an async method, so perhaps use createIfNotExists and dropIfExists

**EDIT2: Well, that will give a knex warning, they suggest use hasTable, so it needs a const exists = await this.hasTable('users')

@iamraphson iamraphson reopened this Jun 28, 2018
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

4 participants