-
Notifications
You must be signed in to change notification settings - Fork 131
feathers generate service vs sequelize model:create #286
Comments
You are mixing and matching generators. You are also using the migrations code from the feathers docs (I know, I wrote it ;)). You should not be using the sequelize generators for anything but migrations, and you should not be creating models in the I recommend not mixing generators. Here's why:
|
@DesignByOnyx , thanks for the clarification.
According to the sequelize doc it doesn't seem to be possible to create a migration without generating a model. I'm trying to come up with a best practice solution.
then delete the model file generated by sequelize and then run the |
Sounds about right to me but maybe @DesignByOnyx can weight in again. I'm going to close this issue though since the generator will stay the way it is for the moment. |
Maybe I'm missing something, but when we create a service via feathersjs' cli, we only get a |
The generator is supposed to get you set up quickly but other than the initial model template and connection setup it will not do anything specific to the ORM/database you chose. In most ORMs adding columns is a line or two of code. |
Ok, makes sense!
… On 18 Dec 2017, at 01:53, David Luecke ***@***.***> wrote:
The generator is supposed to get you set up quickly but other than the initial model template and connection setup it will not do anything specific to the ORM/database you chose. In most ORMs adding columns is a line or two of code.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
But there is a way to to import all columns to the model? instead of only gettin a "text" column? I have a lot of tables with a lots of columns, there will be a mess write all on hand, instead of having a cli command like loopback have as "discover" there is something similar in feathersjs? |
In the context of using sequelize with feathers:
to create a model you can run
a model file is created accordingly in the migration folder specified by a .sequelizerc
in this example you get :
/migrations/models/post
Once the model is generated next step is to create a service
another model is created under
/src/models/post.model.js
Ideally, it would be nice when the generator is running it detects that a model is already there and either make a
require
of it or copy the table creation part and add any feathers specific.The text was updated successfully, but these errors were encountered: