Coder Social home page Coder Social logo

Comments (17)

nielsgl avatar nielsgl commented on May 23, 2024 1

@jdgarvey @rjw209
Sorry I was traveling a lot the past weeks, I plan on getting it updated this weekend. I'll release the library v3 with support for Sequelize v4 and then probably the library as v4 with support for Sequelize v5.

from sequelize-paper-trail.

rjw209 avatar rjw209 commented on May 23, 2024 1

@nielsgl Thanks for the update & clarification! I'm heads-down on another task at the moment, but will prioritize revisiting this as soon as I can carve out some time then will report back with any findings.

from sequelize-paper-trail.

Wolvan avatar Wolvan commented on May 23, 2024 1

Alright, mdl.hasPaperTrail is now defined and successfully defines a Revision prop on the models. Haven't looked deeper into it yet, but it looks promising enough!

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

Thanks for the heads up :) I'll check it out soon and see what I need to change to make it work, first need to work out a few bugs with the current library.

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

@matyaspeto ok I got it working in a test version, I'll create a branch for it later today and try to push a beta version by tomorrow.

from sequelize-paper-trail.

jdgarvey avatar jdgarvey commented on May 23, 2024

@nielsgl I've been getting this error as well. I'm guessing that Sequelize v5 support wasn't included in 3.0.0-rc.6 (assuming this because of #74)?

from sequelize-paper-trail.

rjw209 avatar rjw209 commented on May 23, 2024

@nielsgl

@matyaspeto ok I got it working in a test version, I'll create a branch for it later today and try to push a beta version by tomorrow.

Any updates when this branch might be available/ready? I've been tasked with migrating from Sequelize 4 to 5 because of sequelize/sequelize#8468.

from sequelize-paper-trail.

createthis avatar createthis commented on May 23, 2024

I'm kind of confused. What does sequelize-paper-trail v3 add to make it sequelize v4 compatible? We've been using sequelize-paper-trail v2.4.2 with sequelize v4.43.2 for a while now without trouble. We're not power users, but this is news to me that it isn't v4 compatible.

from sequelize-paper-trail.

Wolvan avatar Wolvan commented on May 23, 2024

Any progress on releasing v4?

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

@jdgarvey @rjw209 @Wolvan
Can you try it with 3.0.0-rc.7, that should work with Sequelize v4.

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

Correction, should work with Sequelize v5 👍

from sequelize-paper-trail.

Wolvan avatar Wolvan commented on May 23, 2024

I'll be giving it a try on monday, thanks a lot though!

from sequelize-paper-trail.

Wolvan avatar Wolvan commented on May 23, 2024

Alright, so tried it out: Two things I noticed immediately:

You must have left a test variable or something in the exports in /dist/helpers.js:112:3 (see here I think). Trying to run that errors out with ReferenceError: test is not defined

I also noticed that rc.7 depends on sequelize 4.x and installs that as a dependency (which it probably uses instead of the project's sequelize 5)

The .hasPaperTrail function on models unfortunately is still undefined. This is my code:

sqlize.import(resolve(__dirname, "./models", "Users.js"));
const PaperTrail = papertrail.init(sqlize, {
    userModel: "Users",
    debug: commander.debug
});

PaperTrail.defineModels();

let models = await fs.readdir(resolve(__dirname, "./models"));
models.forEach(model => {
    log.debug("Importing Model '" + model + "'");
    const mdl = sqlize.import(resolve(__dirname, "./models", model));
    if (mdl.hasPaperTrail) mdl.Revisions = mdl.hasPaperTrail();
});

Breakpointing at Ln13 and using the debugger to verify hasPaperTrail's value gives me undefined

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

You must have left a test variable or something in the exports in /dist/helpers.js:112:3 (see here I think). Trying to run that errors out with ReferenceError: test is not defined

Ok fixed this 👍

I also noticed that rc.7 depends on sequelize 4.x and installs that as a dependency (which it probably uses instead of the project's sequelize 5)

Moved the dependency to dev dependencies so that should fix this.

I'll try tonight to quickly test it to get it working.

from sequelize-paper-trail.

nielsgl avatar nielsgl commented on May 23, 2024

@Wolvan I think it's fixed now, at least the tests are passing with Sequelize v5. Released as 3.0.0-rc.8

from sequelize-paper-trail.

thantez avatar thantez commented on May 23, 2024

Hi.
I had this problem with sequelize v5.9.4 and sequelize-paper-trail v2.6.1 then I tried use rc version of sequelize-paper-trail for my project and error hasPaperTrail is not a function resolved! but new problems raised.
this is my first init options:
const paperTrail = PaperTrail.init(sequelize, { debug: true, userModel: 'user', exclude: [ 'createdAt', 'updatedAt' ], enableRevisionChangeModel: true, UUID: true, continuationKey: 'userId' })

when I tried to save a new user, user inserted to postgres but I gave this error in console:
sql: 'INSERT INTO "Revisions" ("model","document","operation","documentId","revision","id","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING *;' }, sql: 'INSERT INTO "Revisions" ("model","document","operation","documentId","revision","id","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING *;' } (node:6688) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: invalid input syntax for type uuid: "1"
then I removed UUID: true from init options and tried again, so I gave this:
Executing (default): INSERT INTO "Revisions" ("id","model","document","operation","documentId","revision","createdAt","updatedAt") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7) RETURNING *; Revision save error TypeError: Cannot read property 'diffChars' of undefined
what should I doing? is this a bug?
thanks a lot.

from sequelize-paper-trail.

VasukiShayanaa avatar VasukiShayanaa commented on May 23, 2024

Hi.
I had this problem with sequelize v5.9.4 and sequelize-paper-trail v2.6.1 then I tried use rc version of sequelize-paper-trail for my project and error hasPaperTrail is not a function resolved! but new problems raised.
this is my first init options:
const paperTrail = PaperTrail.init(sequelize, { debug: true, userModel: 'user', exclude: [ 'createdAt', 'updatedAt' ], enableRevisionChangeModel: true, UUID: true, continuationKey: 'userId' })

when I tried to save a new user, user inserted to postgres but I gave this error in console:
sql: 'INSERT INTO "Revisions" ("model","document","operation","documentId","revision","id","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING *;' }, sql: 'INSERT INTO "Revisions" ("model","document","operation","documentId","revision","id","createdAt","updatedAt") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING *;' } (node:6688) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: invalid input syntax for type uuid: "1"
then I removed UUID: true from init options and tried again, so I gave this:
Executing (default): INSERT INTO "Revisions" ("id","model","document","operation","documentId","revision","createdAt","updatedAt") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7) RETURNING *; Revision save error TypeError: Cannot read property 'diffChars' of undefined
what should I doing? is this a bug?
thanks a lot.

try passing UUID: true, in options

from sequelize-paper-trail.

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.