Skip to content

Commit a107729

Browse files
authored
Merge pull request #96 from paparomeo/support-latest-jsonapi-server
Support latest `jsonapi-server`.
2 parents 61c160a + ec404ae commit a107729

File tree

6 files changed

+411
-392
lines changed

6 files changed

+411
-392
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
- 2017-12-12 - v5.0.0
2+
- 2017-12-12 - Support latest version of `jsonapi-server` with store managed id support.
3+
- 2017-12-12 - Revert column type for `string` properties back to `string` from `text`.
4+
- 2017-12-12 - Remove support for Node.js 4.
15
- 2017-10-09 - v4.0.0
26
- 2017-10-09 - Optimised Sequelize UUID column type for ids.
37
- 2017-10-02 - v3.0.0

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
[![Code Climate](https://codeclimate.com/github/holidayextras/jsonapi-store-relationaldb/badges/gpa.svg)](https://codeclimate.com/github/holidayextras/jsonapi-store-relationaldb)
55
[![Dependencies Status](https://david-dm.org/holidayextras/jsonapi-store-relationaldb.svg)](https://david-dm.org/holidayextras/jsonapi-store-relationaldb)
66

7-
87
# jsonapi-store-relationaldb
98

9+
#### :warning: PLEASE NOTE: Version 4.x releases erroneously created columns for `string` properties as Sequelize `text` type. The behaviour in version 5.x has reverted back to creating columns with the Sequelize `string` type, which is the more adequate type and was the behaviour in versions 3.x and older. The `text` columns created by version 4.x will need to be manually migrated to `string` columns.
10+
1011
`jsonapi-store-relationaldb` is a relational database backed data store for [`jsonapi-server`](https://github.com/holidayextras/jsonapi-server).
1112

1213
This project conforms to the specification laid out in the [jsonapi-server handler documentation](https://github.com/holidayextras/jsonapi-server/blob/master/documentation/handlers.md).

lib/modelGenerators/default.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = class {
3232
const attribute = joiSchema[attributeName]
3333
if (attribute._type === 'string') {
3434
this[attributeName] = {
35-
type: DataTypes.TEXT,
35+
type: DataTypes.STRING,
3636
allowNull: true
3737
}
3838
}
@@ -68,6 +68,13 @@ module.exports = class {
6868
}
6969
}
7070
}
71+
if (attributeName === 'id') {
72+
delete this[attributeName].allowNull
73+
Object.assign(this[attributeName], {
74+
type: DataTypes.STRING(128),
75+
primaryKey: true
76+
})
77+
}
7178
}
7279
}
7380
}

0 commit comments

Comments
 (0)