Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use string ids on Credentials, Workflows, Tags, and Executions DB entities #5041

Merged
merged 22 commits into from
Jan 2, 2023

Conversation

netroy
Copy link
Member

@netroy netroy commented Dec 27, 2022

instead of transforming between string and number throughout the code
@netroy netroy requested review from krynble and ivov December 27, 2022 18:06
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Dec 27, 2022
@ivov
Copy link
Contributor

ivov commented Dec 28, 2022

https://linear.app/n8n/issue/N8N-3097/marshalling-column-values-in-entity-models

@netroy netroy changed the title refactor: Use string ids on Credentials, Workflows, and Executions DB entities refactor: Use string ids on Credentials, Workflows, and Executions DB entities N8N-3097 Dec 28, 2022
@netroy netroy changed the title refactor: Use string ids on Credentials, Workflows, and Executions DB entities N8N-3097 refactor: Use string ids on Credentials, Workflows, and Executions DB entities Dec 28, 2022
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More IDs to update:

  • IWorkflowMetadata at /workflow/src/Interfaces.ts
  • IExecutionBase at packages/editor-ui/src/Interface.ts

(Unless they had to be excluded for some reason.)

Only code review, untested.

packages/cli/src/CredentialsHelper.ts Outdated Show resolved Hide resolved
packages/cli/src/Interfaces.ts Outdated Show resolved Hide resolved
packages/cli/src/Interfaces.ts Outdated Show resolved Hide resolved
packages/cli/src/workflows/workflows.services.ee.ts Outdated Show resolved Hide resolved
packages/cli/src/workflows/workflows.services.ts Outdated Show resolved Hide resolved
packages/cli/test/integration/credentials.test.ts Outdated Show resolved Hide resolved
packages/cli/test/unit/PermissionChecker.test.ts Outdated Show resolved Hide resolved
packages/cli/test/unit/PermissionChecker.test.ts Outdated Show resolved Hide resolved
@netroy netroy changed the title refactor: Use string ids on Credentials, Workflows, and Executions DB entities refactor: Use string ids on Credentials, Workflows, Tags, and Executions DB entities Dec 28, 2022
@netroy netroy requested a review from ivov December 28, 2022 20:18
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job :)

A few more I found:

  • IExecutionBase['retrySuccessId'] in cli is still string | number but string in editor-ui
  • credentialId in CredentialConfig.vue is still [String, Number]

Otherwise code looks good, I'll test tomorrow.

packages/cli/src/UserManagement/routes/users.ts Outdated Show resolved Hide resolved
packages/cli/src/credentials/credentials.service.ts Outdated Show resolved Hide resolved
packages/cli/src/workflows/workflows.services.ts Outdated Show resolved Hide resolved
@netroy netroy requested a review from ivov December 29, 2022 17:29
@ivov
Copy link
Contributor

ivov commented Dec 30, 2022

  1. Filtering executions glitches out: https://share.cleanshot.com/zT0tYKfb
  2. Deleting execution throws error: https://share.cleanshot.com/1JB5vxkh
  3. Public API schemas need updating: example
  4. ITemplatesCollection has workflows: Array<{ id: number }>
  5. Searching for id: .*number in cli shows typings for QueryRunner results with number IDs.
  6. executeBatch.ts still has number IDs.
  7. Tested all I could think of except sharing. Best for sb who knows sharing well to test that feature.

@netroy
Copy link
Member Author

netroy commented Jan 2, 2023

  1. Filtering executions glitches out: https://share.cleanshot.com/zT0tYKfb
  2. Deleting execution throws error: https://share.cleanshot.com/1JB5vxkh

These both exist on master, and were likely introduced in #5035.
1 will be fixed in #5071

3. Public API schemas need updating: [example](https://github.com/n8n-io/n8n/blob/99e3eb634bd34fa6791e09f112ce9e49407fed49/packages/cli/src/PublicApi/v1/handlers/workflows/spec/schemas/workflow.yml#L10)

4. `ITemplatesCollection` has `workflows: Array<{ id: number }>`

This represents data coming from api.n8n.io. If we want to change this, we should probably also change it in the website code.

5. Searching for `id: .*number` in cli shows typings for `QueryRunner` results with number IDs.

I looked at those. Those are all migrations, and should not be changed, as they do not use entity transformers.

6. `executeBatch.ts` still has number IDs.

7. Tested all I could think of except sharing. Best for sb who knows sharing well to test that feature.

Will ask Omar 👍🏽

@netroy netroy merged commit ee28213 into master Jan 2, 2023
@netroy netroy deleted the string-ids branch January 2, 2023 16:42
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Jan 2, 2023
@ivov
Copy link
Contributor

ivov commented Jan 3, 2023

Public API schemas changed, should we update version?

@janober
Copy link
Member

janober commented Jan 5, 2023

Got released with n8n@0.210.0

@janober janober removed the Upcoming Release Will be part of the upcoming release label Jan 5, 2023
netroy added a commit that referenced this pull request Jan 25, 2023
This was incorrectly changed in #5041
netroy added a commit that referenced this pull request Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants