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

setting up postgres, running sequelize init #207

Closed
WestleyArgentum opened this issue Apr 26, 2016 · 6 comments
Closed

setting up postgres, running sequelize init #207

WestleyArgentum opened this issue Apr 26, 2016 · 6 comments

Comments

@WestleyArgentum
Copy link
Contributor

I'm having trouble setting up postgres.

I've followed the docs, set up my database, run

createuser root
createdb react_webpack_node_development # or test/production

But when I try to run npm run sequelize db:migrate, I get an error saying that I should run sequelize init.

Fair enough, so I do that, but then it creates a new config and empty folders for migrations, etc.

Looking in ./server/db/sequelize I see the migrations I think I'm supposed to be using... but I'm at a loss as to how to configure sequelize to use them...

Any help would be greatly appreciated!

@WestleyArgentum
Copy link
Contributor Author

Ah.

I had to cd into ./server/db/sequelize and run ../../../node_modules/.bin/sequelize db:migrate --config ./sequelize_config.js

I would close this and submit a PR to the docs, but that ../../../node_modules/.bin/sequelize is pretty messy... unfortunately it didn't work when I just ran npm run sequelize db:migrate --config ./sequelize_config.js

Do you think there is some way to explain this in the docs and or restructure the sequelize config?

@choonkending
Copy link
Member

@WestleyArgentum Thanks for creating this issue.

Interesting. When I was running through this docs with a fresh clone, I didn't have to run sequelize init, so I didn't have the issue when running npm run sequelize :(

@mjewell might have more context to this issue. 🍶

@mjewell
Copy link
Contributor

mjewell commented Apr 26, 2016

Hey,

For me just running npm run sequelize db:migrate works fine. If it's asking for sequelize init that means it can't find sequelize_config.js, but the .sequelizerc file should be telling it where to look for that, and at least locally npm run sequelize db:migrate seems to work from any subdirectory in the project. Did you somehow lose the .sequelizerc file?

Regardless, if you do want to run the command you were trying, you will have use a slightly different syntax due to the way npm scripts handle args. If you look here it explains it, but the TL;DR is npm run sequelize db:migrate -- --config ./path/to/sequelize_config.js.

@WestleyArgentum
Copy link
Contributor Author

Oh my gosh, I'm sorry, at some point I must have copied files over in osx finder and thereby lost all the .files

Thanks very much, sorry for the noise

@mjewell
Copy link
Contributor

mjewell commented Apr 26, 2016

Haha, no problem. Glad it's all working

@m-liddell
Copy link

I've tried all the ways mentioned here and keep getting:

Sequelize [Node: 10.1.0, CLI: 2.8.0, ORM: 3.30.4]

(node:4737) ExperimentalWarning: The fs.promises API is experimental
gulp[4743]: ../src/node_contextify.cc:628:static void node::contextify::ContextifyScript::New(const v8::FunctionCallbackInfov8::Value&): Assertion `args[1]->IsString()' failed.
1: node::Abort() [gulp]
2: 0x876c55 [gulp]
3: node::contextify::ContextifyScript::New(v8::FunctionCallbackInfov8::Value const&) [gulp]
4: v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [gulp]
5: 0xacd2df [gulp]
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [gulp]
7: 0x3a1f8d20427d

Anyone have any idea what is going wrong?

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