Giter Site home page Giter Site logo

sequelize-history's People

Contributors

tylerjpeterson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sequelize-history's Issues

No modelid when saving w/o id field

If I do a save() operation on a model like so

Ticket.prototype.setState = function(status) {
  this.status = status;
  return this.save({fields:['status']}); 
}

the modelid field gets not set in the history table. If I add the id field in fields, everything is fine. Just to let you know.

Using UUID as a primary key

I use UUID as the primary key in all my tables, so this is not compatible with this library because the modelID column is hardcode to only be INTEGER.

#7 Will check the type of the primary key in the source table as it is creating the History table.

this.model.hook is not a function

Model.hook() is not a method of the sequelize model instance. It should be 'addHook'.

Changing this.model.hook and this.modelHistory.hook to this.model.addHook and this.modelHistory.addHook respectively in the hookup() in index.js method fixes this.

Unless I'm missing something of course in how i'm supposed to use the package!!

Clarification request: authorFieldName and model/revision associations

From README.md:

NOTE - if authorFieldName is set, hasMany and belongsTo relationships will be created between the history model and the target model. This is to ensure that constraints are not enforced in creating the associations.

Can you clarify this? Which constraints would be a problem, and why? Also, why does this matter only when there is an author field? Why not create these associations always? It would be great to be able to do MyModel.findAll({ include: "revisions" }) out of the box. I don't see what the author field has anything to do with this.

Add ability to change sequelize options for history table

Hi.

It will be good if you will add ability to change sequelize options for history table.
Its only 2 lines of code.

line 49:
change in sequelize.define in constructor
from:

sequelize.define(
	this.modelName,
	this.setAttributes(),
	{});

to:

sequelize.define(
	this.modelName,
	this.setAttributes(),
	this.options.modelOptions);

and SequelizeHistory.DEFAULTS in line 269 into:

SequelizeHistory.DEFAULTS = {
	// Object used to get access to sequelize table settings
	modelOptions: {},
        // rest of options...

It will just add access into sequelize table options.

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.