Skip to content

Commit

Permalink
Sequelize v6 (#527)
Browse files Browse the repository at this point in the history
* Sequelize v6

* use exact, stable version of sequelize

Co-authored-by: Misha Kaletsky <mmkal@users.noreply.github.com>
  • Loading branch information
mmkal and mmkal committed Dec 16, 2021
1 parent 0bea5d1 commit ca2db34
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 80 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ jobs:
strategy:
matrix:
node-version: [14.x, 12.x]
sequelize-version: [null, latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install sequelize@${{ matrix.sequelize-version }}
if: matrix.sequelize-version != null
- run: npm run lint
if: matrix.sequelize-version == null
- run: npm run test -- --coverage
- name: Coverage
uses: codecov/codecov-action@v2
if: matrix.node-version == '14.x' && matrix.sequelize-version == null
if: matrix.node-version == '14.x'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ Using `SequelizeStorage` will create a table in your SQL database called `Sequel

Detailed documentation for the options it can take are in the `_SequelizeStorageConstructorOptions` TypeScript interface, which can be found in [src/storage/sequelize.ts](./src/storage/sequelize.ts).

This library has been tested with sequelize v6. It may or may not work with lower versions - use at your own risk.

#### MongoDB Storage

Using `MongoDBStorage` will create a collection in your MongoDB database called `migrations` containing an entry for each executed migration. You will have either to pass a MongoDB Driver Collection as `collection` property. Alternatively you can pass a established MongoDB Driver connection and a collection name.
Expand Down
108 changes: 41 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"lodash": "4.17.21",
"np": "7.6.0",
"prettier": "2.5.1",
"sequelize": "5.22.4",
"sequelize": "6.11.0",
"sinon": "12.0.1",
"source-map-support": "0.5.21",
"sqlite3": "5.0.2",
Expand Down
14 changes: 7 additions & 7 deletions test/storage/sequelize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ import path = require('path');
import { v4 as uuid } from 'uuid';
import jetpack = require('fs-jetpack');

// TODO [>=3.0.0]: Investigate whether we are mis-using `model.describe()` here, and get rid of `any`.
// TOMAYBEDO: Investigate whether we are mis-using `model.describe()` here, and get rid of `any`.
// See https://github.com/sequelize/umzug/pull/226 and https://github.com/sequelize/sequelize/issues/12296 for details
const describeModel = (model: any) =>
model.describe().then((d: any) => {
// FIXME [sequelize@>=6] remove this hack when only sequelize>=6 is supported
Object.keys(d).forEach(k => delete d[k].unique);
return d;
});
const describeModel = (model: any) => model.describe();

describe('sequelize', () => {
jetpack.cwd(__dirname).dir('tmp', { empty: true });
Expand Down Expand Up @@ -76,6 +71,7 @@ describe('sequelize', () => {
"defaultValue": undefined,
"primaryKey": true,
"type": "VARCHAR(255)",
"unique": true,
},
}
`);
Expand Down Expand Up @@ -120,6 +116,7 @@ describe('sequelize', () => {
"defaultValue": undefined,
"primaryKey": true,
"type": "VARCHAR(255)",
"unique": true,
},
}
`);
Expand All @@ -142,18 +139,21 @@ describe('sequelize', () => {
"defaultValue": undefined,
"primaryKey": false,
"type": "DATETIME",
"unique": false,
},
"name": Object {
"allowNull": false,
"defaultValue": undefined,
"primaryKey": true,
"type": "VARCHAR(255)",
"unique": true,
},
"updatedAt": Object {
"allowNull": false,
"defaultValue": undefined,
"primaryKey": false,
"type": "DATETIME",
"unique": false,
},
}
`);
Expand Down

0 comments on commit ca2db34

Please sign in to comment.