I am using waterline orm which comes by default with sails.js. I recently recognized that my data just goes missing in my MySQL database when I do a sails lift. My model config is alter. Did anyone face similar issues? This is scary.
change your model config to 'safe' so it wont erase your data after you resetart your server..
Related
Since yet I have always worked in C# with ORM's like Entity Framework, but now I want to start with NodeJS, since I need it for school.
In NodeJS I started using Sequelize since it seems to be the most famous ORM for NodeJS, but I have quite a few problems with it:
Why do I have to write, when chaning or expanding a model, the changes on my own in a migration. Is there a way to let a package automated write my migrations depending on my model changes like it is in entity framework by default. (I have already tried sequelize-mig and sequelize-auto-migration npm packages, but they didn't work)
Is it possible to let a sequelize model inheritate from an other sequelize model. For instance I have a model User which has the properties name and password (only an example). Now I want to expand the model by creating a new model that should have the name UserWithToken and should extend User and has an additional attribute token. Is this possible?
I'm trying to make an application with node.js and sequelize ORM. I learnt about the function Sequelize.sync() to update database schema based on the app model.
Is there a way to log the SQL statements that Sequelize.sync() would run without executing them?
I'm used to Doctrine ORM where such a thing is possible and quite convenient (it allows to double-check your model before actually persisting it to the DB).
Is there a way to do it with sequelize too?
Thanks
I create a ReactJS app using Sequelize and PostgreSQL database. I defined my models on my ReactJS API, but I need to use the same database (so the same models) on an other API.
How should I do so without writing again the definition of each model, because if I made a change, I would have to do it everywhere. Is there a better way to handle this king of problem?
Why I don't use the ReactJS API? Because when I built my React app, the API disappears: I'm using proxy.
var myModel = require('./models/myModel');
you can add by require here my model is in root directory inside model folder.
You could place the models in their own separate Node.js package, so they could be reused by both.
Please, refer to this: https://docs.npmjs.com/getting-started/creating-node-modules
I'm currently migrating my project form sails to koajs,
and i can't figure out how mongodb association is working in koajs.
I tried this code hoping that it will run, but it's hopeless.
properties.find({}).populate('user').sort('updatedAt DESC')
I'm currently using co-monk as a middleware. co-monk
Is there any middleware that can i use? So that i can use the mongodb association?
I tried searching at google but it gives me nothing.
Hopes that there is a solution.
Thanks guys.
I'm trying to use Waterline in my express application but how do I configure the database connection? I would like to use sails-mongo as an adapter but I'm not sure how to do it. Can any one help me with this problem?
Thanks
There is an example of using Waterline with Express in the Waterline Repo: https://github.com/balderdashy/waterline/blob/master/example/express/express-example.js