mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
ci: Fix mysql tests (no-changelog) (#11799)
This commit is contained in:
parent
10991675fe
commit
e1dacb4d57
16
.github/docker-compose.yml
vendored
16
.github/docker-compose.yml
vendored
|
@ -1,18 +1,12 @@
|
||||||
version: '3.9'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mariadb:
|
||||||
image: mysql:5.7
|
image: mariadb:10.9
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_DATABASE=n8n
|
- MARIADB_DATABASE=n8n
|
||||||
- MYSQL_ROOT_PASSWORD=password
|
- MARIADB_ROOT_PASSWORD=password
|
||||||
|
- MARIADB_MYSQL_LOCALHOST_USER=true
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
ulimits:
|
|
||||||
nproc: 65535
|
|
||||||
nofile:
|
|
||||||
soft: 26677
|
|
||||||
hard: 46677
|
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16
|
image: postgres:16
|
||||||
|
|
17
.github/workflows/ci-postgres-mysql.yml
vendored
17
.github/workflows/ci-postgres-mysql.yml
vendored
|
@ -8,6 +8,7 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- packages/cli/src/databases/**
|
- packages/cli/src/databases/**
|
||||||
- .github/workflows/ci-postgres-mysql.yml
|
- .github/workflows/ci-postgres-mysql.yml
|
||||||
|
- .github/docker-compose.yml
|
||||||
pull_request_review:
|
pull_request_review:
|
||||||
types: [submitted]
|
types: [submitted]
|
||||||
|
|
||||||
|
@ -71,8 +72,8 @@ jobs:
|
||||||
working-directory: packages/cli
|
working-directory: packages/cli
|
||||||
run: pnpm jest
|
run: pnpm jest
|
||||||
|
|
||||||
mysql:
|
mariadb:
|
||||||
name: MySQL
|
name: MariaDB
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
@ -96,16 +97,16 @@ jobs:
|
||||||
path: ./packages/**/dist
|
path: ./packages/**/dist
|
||||||
key: ${{ github.sha }}:db-tests
|
key: ${{ github.sha }}:db-tests
|
||||||
|
|
||||||
- name: Start MySQL
|
- name: Start MariaDB
|
||||||
uses: isbang/compose-action@v2.0.0
|
uses: isbang/compose-action@v2.0.0
|
||||||
with:
|
with:
|
||||||
compose-file: ./.github/docker-compose.yml
|
compose-file: ./.github/docker-compose.yml
|
||||||
services: |
|
services: |
|
||||||
mysql
|
mariadb
|
||||||
|
|
||||||
- name: Test MySQL
|
- name: Test MariaDB
|
||||||
working-directory: packages/cli
|
working-directory: packages/cli
|
||||||
run: pnpm test:mysql --testTimeout 20000
|
run: pnpm test:mariadb --testTimeout 20000
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
name: Postgres
|
name: Postgres
|
||||||
|
@ -147,7 +148,7 @@ jobs:
|
||||||
notify-on-failure:
|
notify-on-failure:
|
||||||
name: Notify Slack on failure
|
name: Notify Slack on failure
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [mysql, postgres]
|
needs: [mariadb, postgres]
|
||||||
steps:
|
steps:
|
||||||
- name: Notify Slack on failure
|
- name: Notify Slack on failure
|
||||||
uses: act10ns/slack@v2.0.0
|
uses: act10ns/slack@v2.0.0
|
||||||
|
@ -156,4 +157,4 @@ jobs:
|
||||||
status: ${{ job.status }}
|
status: ${{ job.status }}
|
||||||
channel: '#alerts-build'
|
channel: '#alerts-build'
|
||||||
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||||
message: Postgres or MySQL tests failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
message: Postgres or MariaDB tests failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
"test:dev": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest --watch",
|
"test:dev": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest --watch",
|
||||||
"test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest",
|
"test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest",
|
||||||
"test:postgres": "N8N_LOG_LEVEL=silent DB_TYPE=postgresdb DB_POSTGRESDB_SCHEMA=alt_schema DB_TABLE_PREFIX=test_ jest --no-coverage",
|
"test:postgres": "N8N_LOG_LEVEL=silent DB_TYPE=postgresdb DB_POSTGRESDB_SCHEMA=alt_schema DB_TABLE_PREFIX=test_ jest --no-coverage",
|
||||||
"test:mysql": "N8N_LOG_LEVEL=silent DB_TYPE=mysqldb DB_TABLE_PREFIX=test_ jest --no-coverage",
|
"test:mariadb": "N8N_LOG_LEVEL=silent DB_TYPE=mariadb DB_TABLE_PREFIX=test_ jest --no-coverage",
|
||||||
"watch": "tsc-watch -p tsconfig.build.json --onCompilationComplete \"tsc-alias -p tsconfig.build.json\""
|
"watch": "tsc-watch -p tsconfig.build.json --onCompilationComplete \"tsc-alias -p tsconfig.build.json\""
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
);
|
);
|
||||||
await queryRunner.query(`UPDATE ${tablePrefix}workflow_entity SET id = CONVERT(tmp_id, CHAR);`);
|
await queryRunner.query(`UPDATE ${tablePrefix}workflow_entity SET id = CONVERT(tmp_id, CHAR);`);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX \`TMP_idx_${tablePrefix}workflow_entity_id\` ON ${tablePrefix}workflow_entity (\`id\`);`,
|
`CREATE UNIQUE INDEX \`TMP_idx_${tablePrefix}workflow_entity_id\` ON ${tablePrefix}workflow_entity (\`id\`);`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -40,7 +40,7 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
);
|
);
|
||||||
await queryRunner.query(`UPDATE ${tablePrefix}tag_entity SET id = CONVERT(tmp_id, CHAR);`);
|
await queryRunner.query(`UPDATE ${tablePrefix}tag_entity SET id = CONVERT(tmp_id, CHAR);`);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX \`TMP_idx_${tablePrefix}tag_entity_id\` ON ${tablePrefix}tag_entity (\`id\`);`,
|
`CREATE UNIQUE INDEX \`TMP_idx_${tablePrefix}tag_entity_id\` ON ${tablePrefix}tag_entity (\`id\`);`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -65,7 +65,7 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
`ALTER TABLE ${tablePrefix}workflows_tags DROP PRIMARY KEY, ADD PRIMARY KEY (\`workflowId\`, \`tagId\`);`,
|
`ALTER TABLE ${tablePrefix}workflows_tags DROP PRIMARY KEY, ADD PRIMARY KEY (\`workflowId\`, \`tagId\`);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX \`idx_${tablePrefix}workflows_tags_workflowid\` ON ${tablePrefix}workflows_tags (\`workflowId\`);`,
|
`CREATE INDEX \`idx_${tablePrefix}workflows_tags_workflow_id\` ON ${tablePrefix}workflows_tags (\`workflowId\`);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE ${tablePrefix}workflows_tags DROP FOREIGN KEY \`FK_${tablePrefix}54b2f0343d6a2078fa137443869\`;`,
|
`ALTER TABLE ${tablePrefix}workflows_tags DROP FOREIGN KEY \`FK_${tablePrefix}54b2f0343d6a2078fa137443869\`;`,
|
||||||
|
@ -207,7 +207,7 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
`UPDATE ${tablePrefix}credentials_entity SET id = CONVERT(tmp_id, CHAR);`,
|
`UPDATE ${tablePrefix}credentials_entity SET id = CONVERT(tmp_id, CHAR);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX \`TMP_idx_${tablePrefix}credentials_entity_id\` ON ${tablePrefix}credentials_entity (\`id\`);`,
|
`CREATE UNIQUE INDEX \`TMP_idx_${tablePrefix}credentials_entity_id\` ON ${tablePrefix}credentials_entity (\`id\`);`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -259,7 +259,7 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
`UPDATE ${tablePrefix}variables SET \`id\` = CONVERT(\`tmp_id\`, CHAR);`,
|
`UPDATE ${tablePrefix}variables SET \`id\` = CONVERT(\`tmp_id\`, CHAR);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX \`TMP_idx_${tablePrefix}variables_id\` ON ${tablePrefix}variables (\`id\`);`,
|
`CREATE UNIQUE INDEX \`TMP_idx_${tablePrefix}variables_id\` ON ${tablePrefix}variables (\`id\`);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE ${tablePrefix}variables CHANGE \`tmp_id\` \`tmp_id\` int NOT NULL;`,
|
`ALTER TABLE ${tablePrefix}variables CHANGE \`tmp_id\` \`tmp_id\` int NOT NULL;`,
|
||||||
|
@ -268,5 +268,8 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr
|
||||||
`ALTER TABLE ${tablePrefix}variables DROP PRIMARY KEY, ADD PRIMARY KEY (\`id\`);`,
|
`ALTER TABLE ${tablePrefix}variables DROP PRIMARY KEY, ADD PRIMARY KEY (\`id\`);`,
|
||||||
);
|
);
|
||||||
await queryRunner.query(`ALTER TABLE ${tablePrefix}variables DROP COLUMN \`tmp_id\`;`);
|
await queryRunner.query(`ALTER TABLE ${tablePrefix}variables DROP COLUMN \`tmp_id\`;`);
|
||||||
|
await queryRunner.query(
|
||||||
|
`DROP INDEX \`TMP_idx_${tablePrefix}variables_id\` ON ${tablePrefix}variables;`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,18 +15,8 @@ export class LicenseMetricsRepository extends Repository<LicenseMetrics> {
|
||||||
}
|
}
|
||||||
|
|
||||||
toTableName(name: string) {
|
toTableName(name: string) {
|
||||||
const tablePrefix = this.globalConfig.database.tablePrefix;
|
const { tablePrefix } = this.globalConfig.database;
|
||||||
|
return this.manager.connection.driver.escape(`${tablePrefix}${name}`);
|
||||||
let tableName =
|
|
||||||
this.globalConfig.database.type === 'mysqldb'
|
|
||||||
? `\`${tablePrefix}${name}\``
|
|
||||||
: `"${tablePrefix}${name}"`;
|
|
||||||
|
|
||||||
const pgSchema = this.globalConfig.database.postgresdb.schema;
|
|
||||||
|
|
||||||
if (pgSchema !== 'public') tableName = [pgSchema, tablePrefix + name].join('.');
|
|
||||||
|
|
||||||
return tableName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLicenseRenewalMetrics() {
|
async getLicenseRenewalMetrics() {
|
||||||
|
|
Loading…
Reference in a new issue