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

feat(core): Add migration to add property userActivated to user settings (no-changelog) #5940

Merged
merged 9 commits into from
Apr 21, 2023

Conversation

RicardoE105
Copy link
Contributor

@RicardoE105 RicardoE105 commented Apr 10, 2023

Context: ADO-460

@RicardoE105 RicardoE105 requested a review from a team as a code owner April 10, 2023 23:05
@github-actions
Copy link
Contributor

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Files matching packages/cli/src/databases/migrations/**:

  • Requested review from at least two engineers on migration.
  • Avoided irreversible data migrations.
  • Avoided deleting or updating data keys.
  • Wrote 'down' migration if possible.

Make sure to check off this list before asking for review.

@RicardoE105 RicardoE105 requested a review from krynble April 10, 2023 23:08
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Apr 10, 2023
Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

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

Screenshot 2023-04-11 at 10 30 37

Migration is failing for MySQL but I'm not sure why. No errors are reported.

@RicardoE105
Copy link
Contributor Author

@krynble quite weird as I tested it. Will have a look. THanks

@RicardoE105 RicardoE105 requested a review from krynble April 11, 2023 16:15
@RicardoE105
Copy link
Contributor Author

@krynble cannot replicate the issue. It works just fine for me. Are you starting n8n with a new database?

@netroy
Copy link
Member

netroy commented Apr 11, 2023

@RicardoE105 RicardoE105 requested a review from netroy April 12, 2023 17:23
@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.14 🎉

Comparison is base (cd89489) 18.49% compared to head (2727b35) 18.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5940      +/-   ##
==========================================
+ Coverage   18.49%   18.64%   +0.14%     
==========================================
  Files        2563     2583      +20     
  Lines      116018   116471     +453     
  Branches    18118    18179      +61     
==========================================
+ Hits        21458    21714     +256     
- Misses      93930    94119     +189     
- Partials      630      638       +8     

see 84 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 requested a review from krynble April 18, 2023 17:13
@RicardoE105
Copy link
Contributor Author

@krynble ended up stringifying the setting and it works with both scenarios (when the query returns a string and when it returns an object) and it's more simple than having an IF to do one or the other.

krynble
krynble previously approved these changes Apr 19, 2023
Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

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

LGTM, working for all databases and set up.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

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.

Tested on sqlite, MySQL, Postgres.

Commented on one migration but also applies to the others.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

3 similar comments
@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

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.

Thanks for addressing!

One doubt I still have:

Re: this comment, if the value at user.settings before the up migration was NULL, running a down migration with JSON_REMOVE() will not restore it back to NULL, i.e., it will only remove the new property and if it was the only one, we will end up with {}. Same for Postgres using -. But let me know if I'm misunderstanding.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105
Copy link
Contributor Author

Re: this comment, if the value at user.settings before the up migration was NULL, running a down migration with JSON_REMOVE() will not restore it back to NULL, i.e., it will only remove the new property and if it was the only one, we will end up with {}. Same for Postgres using -. But let me know if I'm misunderstanding.

I see now what you mean. Previously null values will be now {}. I guess I can update all {} to be null after the first query runs.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 merged commit 8a38624 into master Apr 21, 2023
@RicardoE105 RicardoE105 deleted the ado-460-add-useractivated-flag branch April 21, 2023 15:15
MiloradFilipovic added a commit that referenced this pull request Apr 21, 2023
* master:
  feat(core): Add migration to add property userActivated to user settings (no-changelog) (#5940)
  feat(core): Add license:info command (#6047)
  feat: Replace this.$refs.refName as Vue with InstanceType<T> (no-changelog) (#6050)
  refactor(editor): Turn titleChange mixin to composable (#6059)
  test: Add stickies tests (#5413)
  refactor: Patch to adjust `consistent-type-imports` (no-changelog) (#6057)

# Conflicts:
#	packages/editor-ui/src/components/ExecutionsView/ExecutionPreview.vue
#	packages/editor-ui/src/mixins/workflowRun.ts
MiloradFilipovic added a commit that referenced this pull request Apr 24, 2023
* master: (47 commits)
  feat: Replace Vue.extend with defineComponent in editor-ui (no-changelog) (#6033)
  feat(core): Add migration to add property userActivated to user settings (no-changelog) (#5940)
  feat(core): Add license:info command (#6047)
  feat: Replace this.$refs.refName as Vue with InstanceType<T> (no-changelog) (#6050)
  refactor(editor): Turn titleChange mixin to composable (#6059)
  test: Add stickies tests (#5413)
  refactor: Patch to adjust `consistent-type-imports` (no-changelog) (#6057)
  fix(editor): Resolve expressions for grandparent nodes (#5859)
  ci(editor): Do not run parallel jobs for a single spec (no-changelog) (#6052)
  refactor(editor): Consolidate IN8nUISettings interface (#6055)
  refactor(core): Forbid raw enums (no-changelog)
  refactor(core): Sort variables files under variables folder (#6051)
  fix(core): Add breaking change record for domain and url matching (no-changelog) (#6048)
  feat(editor): Version control paywall (WIP) (#6030)
  feat(editor): Add disable template experiment (#5963)
  feat(core): Upgrade google-timezones-json to use the correct timezone for Sao Paulo (#6042)
  fix(Code Node): Update vm2 to address CVE-2023-30547 (#6039)
  docs: Add proprietary license text (no-changelog) (#6038)
  test(n8n Node): Unit tests (no-changelog)
  refactor: Accumulate `loadOptions` from all node versions to validate (no-changelog) (#6014)
  ...

# Conflicts:
#	packages/cli/src/Server.ts
sunilrr pushed a commit to fl-g6/qp-n8n that referenced this pull request Apr 24, 2023
…ngs (no-changelog) (n8n-io#5940)

* Add userActivated migration

* Fix migration logic

* Remove duplication when retrieving the activated users

* Fix bug updating settings in mysql

* Make userSettings type conform with naming convention

* Disable naming convention rule only in IDatabaseCollections interface

* Fix down method in Postgres migration

* Reset '{}' to NULL when reversing migration
@janober
Copy link
Member

janober commented May 2, 2023

Got released with [email protected]

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 Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants