eseom / hapi-react-fullstack-boilerplate

Hapi, Sequelize, React, etc.
MIT License
21 stars 4 forks source link

Sequelize init and hails #3

Closed pruhstal closed 7 years ago

pruhstal commented 7 years ago

First off -- nice repo! Really digging the code structure.

One thing I'm mainly confused about is hails. So it seems like it's something you rolled on your own, and you reference it in this project. Specifically for some db migrations instead of using sequelize directly. (e.g. : sequelize model:create --name Test --attributes name:string,description:text).

If I ran that command in the root directory, I'd get something like:

Unable to find models path (/Sites/hapi-react-fullstack-boilerplate/db/models). Did you run sequelize init?

I couldn't find out where hails was specifically calling sequelize init, so I'm curious how it works without calling sequelize init?

eseom commented 7 years ago

Thank you first for your praise. Yup, Hails is an incomplete hapijs abstraction of mine. Sequelize assumes that by default there is a model in the models directory, but Hails doesn't need these things because it assumes that the model is in src/server/*/model.js. If you are interested in this issue, I'll fix it right now so that you can run sequelize directly. Thanks

eseom commented 7 years ago

You can now execute

sequelize model:create --name Test --attributes name:string,description:text

then two file would be generated like below.

db/migrations/20170801100059-create-test.js
db/models/test.js

and you should put the contents of the generated model in the appropriate module. ex) src/server/core/model.js

pruhstal commented 7 years ago

Very nice, @eseom. Thank you for the quick response + patch!

I'm starting to get more familiar with the codebase, so it's helpful to know about things like .sequelizerc.

Cheers