At https://github.com/n8n-io/n8n/pull/8213 we introduced Redis hashes
for workflow ownership and manual webhooks...
- to remove clutter from multiple related keys at the top level,
- to improve performance by preventing serializing-deserializing, and
- to guarantee atomicity during concurrent updates in multi-main setup.
Workflow activation errors can also benefit from this. Added test
coverage as well.
To test manually, create a workflow with a trigger with an invalid
credential, edit the workflow's `active` column to `true`, and restart.
The activation error should show as a red triangle on canvas and in the
workflow list.
## Summary
Postgres columns can be
- [generated as
identity](https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-identity-column/)
- [generated by a custom
expression](https://www.postgresql.org/docs/current/ddl-generated-columns.html)
In these 2 cases, the column is not required when inserting a new row.
This PR makes sure these types of column are not marked required in n8n.
### How to test
1. Create a Postgres table with all types of generated columns:
for version >= 10
```sql
CREATE TABLE "public"."test_table" (
"id" int8 NOT NULL DEFAULT nextval('test_table_id_seq'::regclass),
"identity_id" bigint GENERATED ALWAYS AS IDENTITY,
"id_plus" numeric GENERATED ALWAYS AS (id + 5) STORED,
"title" varchar NOT NULL,
"created_at" timestamp DEFAULT now(),
PRIMARY KEY ("id")
)
```
Before 10 you have to use serial or bigserial types:
```sql
CREATE TABLE distributors (
did serial not null primary key,
name varchar(40) NOT NULL CHECK (name <> '')
);
```
2. Add a postgres node to canvas and try to insert data without the
generated columns
3. Should successfully insert
More info in Linear/Github issue ⬇️
## Related tickets and issues
- fixes#7084
-
https://linear.app/n8n/issue/NODE-816/rmc-not-all-id-fields-should-be-required
-
https://linear.app/n8n/issue/NODE-681/postgres-cant-map-automatically-if-database-requires-a-field
## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
## Summary
- Moved out canvas loading handling to canvas store
- Tag editable routes via meta to remove router dependency from generic
helpers
- Replace all occurrences of `genericHelpers` mixin with composable and
audit usage
- Moved out `isRedirectSafe` and `getRedirectQueryParameter` out of
genericHelpers to remove dependency on router
Removing the router dependency is important, because `useRouter` and
`useRoute` compostables are only available if called from component
instance. So if composable is nested within another composable, we
wouldn't be able to use these. In this case we'd always need to inject
the router and pass it through several composables. That's why I moved
the `readonly` logic to router meta and `isRedirectSafe` and
`getRedirectQueryParameter` out as they were only used in a single
component.
---------
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Story: https://linear.app/n8n/issue/PAY-1188
- Implement Redis hashes on the caching service, based on Micha's work
in #7747, adapted from `node-cache-manager-ioredis-yet`. Optimize
workflow ownership lookups and manual webhook lookups with Redis hashes.
- Simplify the caching service by removing all currently unused methods
and options: `enable`, `disable`, `getCache`, `keys`, `keyValues`,
`refreshFunctionEach`, `refreshFunctionMany`, `refreshTtl`, etc.
- Remove the flag `N8N_CACHE_ENABLED`. Currently some features on
`master` are broken with caching disabled, and test webhooks now rely
entirely on caching, for multi-main setup support. We originally
introduced this flag to protect against excessive memory usage, but
total cache usage is low enough that we decided to drop this setting.
Apparently this flag was also never documented.
- Overall caching service refactor: use generics, reduce branching, add
discriminants for cache kinds for better type safety, type caching
events, improve readability, remove outdated docs, etc. Also refactor
and expand caching service tests.
Follow-up to: https://github.com/n8n-io/n8n/pull/8176
---------
Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
- Add extra params to 'User closed cred setup' event
- Fire 'User closed cred setup' only when template has creds
- Skip cred setup page if template has no creds required
- Fire 'User inserted workflow template' also in cred setup
In #8088 template ID was added to workflow metadata, but it was missing
from workflows that were created using the template credential setup.
This fixes that.
## Summary
Required as part of NodeView refactoring:
- Migrates `pinData` mixin to `usePinnedData` composable.
- Adds `useActiveNode` and `useNodeType` composables
## Related tickets and issues
https://linear.app/n8n/issue/N8N-6355/pindata
## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [x] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [x] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
> A feature is not complete without tests.