From 38137d8bc3c0c4dae503e3a3ee319809e8288f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 27 May 2025 11:41:27 +0200 Subject: [PATCH] chore(core): Update all refs from `cli/src/databases` to `@n8n/db` (#15708) --- .github/CODEOWNERS | 2 +- .github/workflows/ci-postgres-mysql.yml | 1 + .../migrations/common/1714133768519-CreateProject.ts | 2 +- packages/@n8n/db/src/repositories/user.repository.ts | 2 +- packages/@n8n/eslint-config/local-rules.js | 10 +++------- packages/cli/src/ldap.ee/__tests__/helpers.test.ts | 2 +- .../cli/src/services/__tests__/user.service.test.ts | 2 +- .../cli/src/sso.ee/saml/__tests__/saml-helpers.test.ts | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d5b4f4a0d0..2d2d5dac1d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -packages/cli/src/databases/migrations/ @n8n-io/migrations-review +packages/@n8n/db/src/migrations/ @n8n-io/migrations-review diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index ea54d91c27..40db66217c 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - packages/cli/src/databases/** + - packages/@n8n/db/** - packages/cli/src/modules/*/database/** - packages/cli/test/integration/** - packages/cli/test/shared/db/** diff --git a/packages/@n8n/db/src/migrations/common/1714133768519-CreateProject.ts b/packages/@n8n/db/src/migrations/common/1714133768519-CreateProject.ts index 64c6ee904d..6bf6ef5f06 100644 --- a/packages/@n8n/db/src/migrations/common/1714133768519-CreateProject.ts +++ b/packages/@n8n/db/src/migrations/common/1714133768519-CreateProject.ts @@ -214,7 +214,7 @@ export class CreateProject1714133768519 implements ReversibleMigration { ); } - // Duplicated from packages/cli/src/databases/entities/User.ts + // Duplicated from packages/@n8n/db/src/entities/User.ts // Reason: // This migration should work the same even if we refactor the function in // `User.ts`. diff --git a/packages/@n8n/db/src/repositories/user.repository.ts b/packages/@n8n/db/src/repositories/user.repository.ts index 5b022024b4..b952c83f30 100644 --- a/packages/@n8n/db/src/repositories/user.repository.ts +++ b/packages/@n8n/db/src/repositories/user.repository.ts @@ -22,7 +22,7 @@ export class UserRepository extends Repository { * @deprecated Use `UserRepository.save` instead if you can. * * We need to use `save` so that that the subscriber in - * packages/cli/src/databases/entities/Project.ts receives the full user. + * packages/@n8n/db/src/entities/Project.ts receives the full user. * With `update` it would only receive the updated fields, e.g. the `id` * would be missing. test('does not use `Repository.update`, but * `Repository.save` instead'. diff --git a/packages/@n8n/eslint-config/local-rules.js b/packages/@n8n/eslint-config/local-rules.js index 7d169a7192..9a3b734c45 100644 --- a/packages/@n8n/eslint-config/local-rules.js +++ b/packages/@n8n/eslint-config/local-rules.js @@ -484,21 +484,17 @@ module.exports = { meta: { type: 'error', docs: { - description: - 'Ensure `@n8n/typeorm` is imported only from within the `packages/cli/src/databases` directory.', + description: 'Ensure `@n8n/typeorm` is imported only from within the `@n8n/db` package.', recommended: 'error', }, messages: { - moveImport: 'Move this import to `packages/cli/src/databases/**/*.ts`.', + moveImport: 'Please move this import to `@n8n/db`.', }, }, create(context) { return { ImportDeclaration(node) { - if ( - node.source.value === '@n8n/typeorm' && - !context.getFilename().includes('packages/cli/src/databases/') - ) { + if (node.source.value === '@n8n/typeorm' && !context.getFilename().includes('@n8n/db')) { context.report({ node, messageId: 'moveImport' }); } }, diff --git a/packages/cli/src/ldap.ee/__tests__/helpers.test.ts b/packages/cli/src/ldap.ee/__tests__/helpers.test.ts index 32b5f01983..e5984932d6 100644 --- a/packages/cli/src/ldap.ee/__tests__/helpers.test.ts +++ b/packages/cli/src/ldap.ee/__tests__/helpers.test.ts @@ -11,7 +11,7 @@ const userRepository = mockInstance(UserRepository); describe('Ldap/helpers', () => { describe('updateLdapUserOnLocalDb', () => { // We need to use `save` so that that the subscriber in - // packages/cli/src/databases/entities/Project.ts receives the full user. + // packages/@n8n/db/src/entities/Project.ts receives the full user. // With `update` it would only receive the updated fields, e.g. the `id` // would be missing. test('does not use `Repository.update`, but `Repository.save` instead', async () => { diff --git a/packages/cli/src/services/__tests__/user.service.test.ts b/packages/cli/src/services/__tests__/user.service.test.ts index 4858f028cf..5c59043f0d 100644 --- a/packages/cli/src/services/__tests__/user.service.test.ts +++ b/packages/cli/src/services/__tests__/user.service.test.ts @@ -80,7 +80,7 @@ describe('UserService', () => { describe('update', () => { // We need to use `save` so that that the subscriber in - // packages/cli/src/databases/entities/Project.ts receives the full user. + // packages/@n8n/db/src/entities/Project.ts receives the full user. // With `update` it would only receive the updated fields, e.g. the `id` // would be missing. it('should use `save` instead of `update`', async () => { diff --git a/packages/cli/src/sso.ee/saml/__tests__/saml-helpers.test.ts b/packages/cli/src/sso.ee/saml/__tests__/saml-helpers.test.ts index 9d497600f9..7b4e9fa976 100644 --- a/packages/cli/src/sso.ee/saml/__tests__/saml-helpers.test.ts +++ b/packages/cli/src/sso.ee/saml/__tests__/saml-helpers.test.ts @@ -14,7 +14,7 @@ mockInstance(AuthIdentityRepository); describe('sso/saml/samlHelpers', () => { describe('updateUserFromSamlAttributes', () => { // We need to use `save` so that that the subscriber in - // packages/cli/src/databases/entities/Project.ts receives the full user. + // packages/@n8n/db/src/entities/Project.ts receives the full user. // With `update` it would only receive the updated fields, e.g. the `id` // would be missing. test('does not user `Repository.update`, but `Repository.save` instead', async () => {