Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Tracking does not populate associated column #89

Open
mrstebo opened this issue Oct 11, 2019 · 1 comment · May be fixed by #90
Open

User Tracking does not populate associated column #89

mrstebo opened this issue Oct 11, 2019 · 1 comment · May be fixed by #90

Comments

@mrstebo
Copy link

mrstebo commented Oct 11, 2019

I have enabled user tracking by following the instructions on the readme. However, when we read Revision.build it does not populate the associated column.

So if I pass the userId to the sequelize options when adding or updating a model I get the following SQL:

Executing (default): INSERT INTO `revisions` (`model`,`document`,`operation`,`document_id`,`revision`,`id`,`created_at`,`updated_at`) VALUES (?,?,?,?,?,?,?,?);
@mrstebo mrstebo linked a pull request Oct 11, 2019 that will close this issue
@vptill
Copy link

vptill commented Mar 21, 2020

I am having the same issue, after looking into the source code, I found out that defineModels is missing the userModelAttribute definition. After adding

if (options.userModel) { attributes[options.userModelAttribute] = { type: _sequelize.default.INTEGER, allowNull: false, }; }

it adds the userId fine. I had to manually create the revision tables though, since the migration just did not do the tables by itself, had to add the userId column manually as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants