Giter Site home page Giter Site logo

Comments (9)

sdepold avatar sdepold commented on May 3, 2024

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.

meetme2meat avatar meetme2meat commented on May 3, 2024

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.

sdepold avatar sdepold commented on May 3, 2024

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.

sdepold avatar sdepold commented on May 3, 2024

see the following url for further information: http://sequelizejs.com/#sync

from sequelize.

sdepold avatar sdepold commented on May 3, 2024

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.

meetme2meat avatar meetme2meat commented on May 3, 2024

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.

sdepold avatar sdepold commented on May 3, 2024

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.

meetme2meat avatar meetme2meat commented on May 3, 2024

Yup That All i want to know and yes the issue might just have been closed accidently.

from sequelize.

meetme2meat avatar meetme2meat commented on May 3, 2024

Thanks Anyway

from sequelize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.