Skip to content

Commit ce19b3d

Browse files
authored
build: merge branch 'main' into v6
2 parents acbc66f + 858ae05 commit ce19b3d

File tree

11 files changed

+1846
-1685
lines changed

11 files changed

+1846
-1685
lines changed

Diff for: .github/workflows/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
DIALECT: postgres
2121
SEQ_PORT: 54320
2222
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-node@v1
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-node@v3
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: yarn install --frozen-lockfile --ignore-engines
@@ -41,8 +41,8 @@ jobs:
4141
DIALECT: mysql
4242
SEQ_PORT: 33060
4343
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions/setup-node@v1
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-node@v3
4646
with:
4747
node-version: ${{ matrix.node-version }}
4848
- run: yarn install --frozen-lockfile --ignore-engines
@@ -61,8 +61,8 @@ jobs:
6161
env:
6262
DIALECT: sqlite
6363
steps:
64-
- uses: actions/checkout@v2
65-
- uses: actions/setup-node@v1
64+
- uses: actions/checkout@v3
65+
- uses: actions/setup-node@v3
6666
with:
6767
node-version: ${{ matrix.node-version }}
6868
- run: yarn install --frozen-lockfile --ignore-engines
@@ -82,8 +82,8 @@ jobs:
8282
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8383
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8484
steps:
85-
- uses: actions/checkout@v2
86-
- uses: actions/setup-node@v2
85+
- uses: actions/checkout@v3
86+
- uses: actions/setup-node@v3
8787
with:
8888
node-version: 16.x
8989
- run: yarn install --frozen-lockfile

Diff for: .github/workflows/codeql-analysis.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
analyze:
11+
name: Analyze
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
15+
contents: read
16+
security-events: write
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
language: [ 'javascript' ]
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
- name: Initialize CodeQL
25+
uses: github/codeql-action/init@v2
26+
with:
27+
languages: ${{ matrix.language }}
28+
- name: Autobuild
29+
uses: github/codeql-action/autobuild@v2
30+
- name: Perform CodeQL Analysis
31+
uses: github/codeql-action/analyze@v2

Diff for: package.json

+20-19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "sequelize-cli",
33
"version": "6.3.0",
44
"description": "The Sequelize CLI",
5+
"types": "./types.d.ts",
56
"bin": {
67
"sequelize": "./lib/sequelize",
78
"sequelize-cli": "./lib/sequelize"
@@ -19,29 +20,29 @@
1920
"yargs": "^16.2.0"
2021
},
2122
"devDependencies": {
22-
"@babel/cli": "^7.16.0",
23-
"@babel/core": "^7.16.0",
24-
"@babel/preset-env": "^7.16.0",
25-
"@babel/register": "^7.16.0",
26-
"@commitlint/cli": "^14.1.0",
27-
"@commitlint/config-angular": "^14.1.0",
28-
"bluebird": "^3.7.2",
29-
"eslint": "^7.32.0",
30-
"eslint-config-prettier": "^8.3.0",
31-
"eslint-plugin-prettier": "^4.0.0",
32-
"expect.js": "^0.3.1",
33-
"gulp": "^4.0.2",
34-
"husky": "^7.0.4",
35-
"lint-staged": "^11.2.6",
36-
"mocha": "^8.4.0",
23+
"@babel/cli": "7.17.10",
24+
"@babel/core": "7.18.5",
25+
"@babel/preset-env": "7.18.2",
26+
"@babel/register": "7.17.7",
27+
"@commitlint/cli": "17.0.2",
28+
"@commitlint/config-angular": "17.0.0",
29+
"bluebird": "3.7.2",
30+
"eslint": "7.32.0",
31+
"eslint-config-prettier": "8.5.0",
32+
"eslint-plugin-prettier": "4.0.0",
33+
"expect.js": "0.3.1",
34+
"gulp": "4.0.2",
35+
"husky": "8.0.1",
36+
"lint-staged": "13.0.2",
37+
"mocha": "9.2.2",
3738
"mysql2": "latest",
3839
"pg": "latest",
3940
"pg-hstore": "latest",
40-
"prettier": "^2.4.1",
41-
"semver": "^7.3.5",
42-
"sequelize": "^6.9.0",
41+
"prettier": "2.7.1",
42+
"semver": "7.3.7",
43+
"sequelize": "6.21.0",
4344
"sqlite3": "latest",
44-
"through2": "^4.0.2"
45+
"through2": "4.0.2"
4546
},
4647
"prettier": {
4748
"trailingComma": "es5",

Diff for: renovate.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"extends": [
3-
"config:base"
3+
"config:js-lib",
4+
":semanticCommitType(build)",
5+
":maintainLockFilesWeekly"
46
]
57
}

Diff for: src/assets/migrations/create-table.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
/** @type {import('sequelize-cli').Migration} */
34
module.exports = {
45
async up (queryInterface, Sequelize) {
56
await queryInterface.createTable('<%= tableName %>', {

Diff for: src/assets/migrations/skeleton.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
/** @type {import('sequelize-cli').Migration} */
34
module.exports = {
45
async up (queryInterface, Sequelize) {
56
/**

Diff for: src/assets/seeders/skeleton.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
/** @type {import('sequelize-cli').Migration} */
34
module.exports = {
45
async up (queryInterface, Sequelize) {
56
/**

Diff for: src/commands/migrate.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ exports.builder = (yargs) =>
1717
.option('from', {
1818
describe: 'Migration name to start migrations from (excluding)',
1919
type: 'string',
20+
})
21+
.option('name', {
22+
describe:
23+
'Migration name. When specified, only this migration will be run. Mutually exclusive with --to and --from',
24+
type: 'string',
25+
conflicts: ['to', 'from'],
2026
}).argv;
2127

2228
exports.handler = async function (args) {
@@ -80,7 +86,13 @@ function migrate(args) {
8086
}
8187
return options;
8288
})
83-
.then((options) => migrator.up(options));
89+
.then((options) => {
90+
if (args.name) {
91+
return migrator.up(args.name);
92+
} else {
93+
return migrator.up(options);
94+
}
95+
});
8496
})
8597
.catch((e) => helpers.view.error(e));
8698
}

Diff for: test/db/migrate.test.js

+36
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,42 @@ describe(Support.getTestDialectTeaser('db:migrate'), () => {
580580
});
581581
});
582582
});
583+
584+
it('--name', function (done) {
585+
const migrationsPath = Support.resolveSupportPath('assets', 'migrations');
586+
const migrations = fs.readdirSync(migrationsPath);
587+
const createPersonMigration = migrations.find((migration) =>
588+
migration.includes('createPerson')
589+
);
590+
591+
prepare(`--name ${createPersonMigration}`, () => {
592+
helpers.readTables(this.sequelize, (tables) => {
593+
expect(tables).to.eql(['Person', 'SequelizeMeta']);
594+
done();
595+
});
596+
});
597+
});
598+
599+
it('--name array', function (done) {
600+
const migrationsPath = Support.resolveSupportPath('assets', 'migrations');
601+
const migrations = fs.readdirSync(migrationsPath);
602+
const createPersonMigration = migrations.find((migration) =>
603+
migration.includes('createPerson')
604+
);
605+
const createPostMigration = migrations.find((migration) =>
606+
migration.includes('createPost')
607+
);
608+
609+
prepare(
610+
`--name ${createPersonMigration} --name ${createPostMigration}`,
611+
() => {
612+
helpers.readTables(this.sequelize, (tables) => {
613+
expect(tables).to.eql(['Person', 'Post', 'SequelizeMeta']);
614+
done();
615+
});
616+
}
617+
);
618+
});
583619
});
584620
});
585621

Diff for: types.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface Migration {
2+
up(
3+
queryInterface: import('sequelize').QueryInterface,
4+
Sequelize: typeof import('sequelize')
5+
): Promise<void>;
6+
down(
7+
queryInterface: import('sequelize').QueryInterface,
8+
Sequelize: typeof import('sequelize')
9+
): Promise<void>;
10+
}

0 commit comments

Comments
 (0)