Comments (9)
hey :) im glad i can just help without changing code :D
u have to call the save function on newly created object :)
lemme know if that worked
from sequelize.
I forgot to mention that I'm calling the save() method on the above "user" object like
user.save()
Still the data isn't getting reflected in database
from sequelize.
is this all of your code? if yes: the sync call is missing:
User.sync() or sequelize.sync()
if not: please paste a gist :)
from sequelize.
see the following url for further information: http://sequelizejs.com/#sync
from sequelize.
i just took a look at your code.
some notes:
- u don't have to specify id, created_at and updated_at. this will be done automatically
- is it correct that your database is named 'users' as specified in new Sequelize(...) ?
from sequelize.
Yes I was missing the "User.sync() " but it assume that table isn't exists(User table) in the database.What if I already have tables exists(user) on the database and i just want to synchronize it with User object created using "sequelize.define('User')"
can i do the same without define the attribute for the object in define block again and gain
I mean just the way what ActiveRecord does (it link your model to your database automatically without you providing "attribute")
I hope I'm not confusing you .But just a small thing i wanted to checkin nothing else
Thanks for the reply
from sequelize.
first one: are u closing the issue by accident :) ?
and the answers:
when u calling Foobar.sync() and such a table already exists in the database, the table will neither dropped, nor truncated nor migrated. sequelize just doesn't do anything.
there are plans for allowing migrations similiar to the rails-way.
furthermore sequelize needs (for now) that you specify the models attribute. this might change with the introduction of the migration-stuff due to the need of analysing the database in order to know what has to be migrated :)
i guess this is what you wanted to know right?
thanks for the interest :)
lemme know if smth. is not clear :)
from sequelize.
Yup That All i want to know and yes the issue might just have been closed accidently.
from sequelize.
Thanks Anyway
from sequelize.
Related Issues (20)
- sequelize.sync() does not create schemas HOT 1
- update操作
- update操作
- SQL parser issue for a specific combination of replacements, "?" symbol matching problem. HOT 3
- Defining HasMany association failed HOT 4
- Default default value is undefined, not null HOT 2
- Creating an array of enums with default value is failing HOT 1
- Incorrect handling of pg table aliases in JOIN ON clauses when using non-default schema in 7.0.0-alpha.37 HOT 1
- Include doesn't seem to work with TediousJS and MSSQL HOT 1
- Invalid Date when using sequelize.query HOT 1
- Syntax error when trying to add enum column with comment that ends with bracket ")". Unterminated quoted string. HOT 2
- Using 'returning' option for [Model].create() returns null values as undefined HOT 1
- Problems referencing associated query conditions that are not primary key fields | BUG! HOT 2
- Problems referencing associated query conditions that are not primary key fields
- where Fn Op.in tulp generates invalid sql HOT 1
- Wrong naming case for eager associations HOT 2
- There is a Simple but important bug, please fix it urgently | BUG! HOT 1
- Compatibility issue with MySQL2 v3.9 HOT 6
- data doesnt update HOT 1
- Subsequent migrations fail after running db:migrate:schema:timestamps:add command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sequelize.