Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Temporalize tables for Sequelize

(aka "Historical records")
(aka "Historical records"). Was Cloned to support primary key option.

This package is a derivative of [sequelize-temporal](https://www.npmjs.com/package/sequelize-temporal), with some bug fixes and major changes merged in. The project is now a substantial divergence from [sequelize-temporal](https://www.npmjs.com/package/sequelize-temporal), so it is no longer interchangeable.

Expand Down
8 changes: 6 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const temporalizeDefaultOptions = {
allowTransactions: true,
logTransactionId: true,
logEventId: true,
eventIdColumnName: 'eventId'
eventIdColumnName: 'eventId',
primaryKey: null,
};

export function Temporalize({
Expand Down Expand Up @@ -254,9 +255,12 @@ export function Temporalize({
}

const afterCreateHook = async function(obj, options) {
const where = {};
const primaryKeyName = temporalizeOptions.primaryKey || 'id';
where[primaryKeyName] = obj[primaryKeyName];
return model
.findOne({
where: { id: obj.id },
where: where,
transaction: options.transaction,
paranoid: false
})
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sequelize-temporalize",
"version": "4.2.0",
"description": "Temporal tables for Sequelize",
"name": "sequelize-historize",
"version": "4.2.3",
"description": "History tables for Sequelize with support with special primary keys",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"directories": {
Expand All @@ -13,7 +13,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/JamesJansson/sequelize-temporalize.git"
"url": "git+https://github.com/ohadperry/sequelize-temporalize.git"
},
"keywords": [
"sequelize",
Expand All @@ -24,12 +24,12 @@
"paranoid",
"historical"
],
"author": "James Jansson <do_not_send_email@email.info> (https://github.com/jamesajansson)",
"author": "Cloned from James Jansson <do_not_send_email@email.info> (https://github.com/jamesajansson)",
"license": "MIT",
"bugs": {
"url": "https://github.com/JamesJansson/sequelize-temporalize/issues"
"url": "https://github.com/ohadperry/sequelize-temporalize/issues"
},
"homepage": "https://github.com/JamesJansson/sequelize-temporalize#readme",
"homepage": "https://github.com/ohadperry/sequelize-temporalize#readme",
"dependencies": {
"@types/mocha": "^5.2.7",
"lodash": "^4.17.11",
Expand Down
Loading