From 58d26c91a2a0c668de8e4327a6ade3291dce2be0 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sat, 10 Sep 2022 08:42:34 +0200 Subject: [PATCH] Resource definitions (CUE) modifications (MySQL) A series of small modifications on resource defintions to simplify MySQL handling. Text fields included into indexes have length and existing lengths are lowered to fit into ~3k char limitation. Most of the changed attributes are can function within the new limitations anyway. --- app/resources.cue | 6 +++--- automation/session.cue | 6 ++++-- automation/trigger.cue | 2 +- system/resource_translation.cue | 6 ++++-- system/template.cue | 4 +++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/resources.cue b/app/resources.cue index 62a270221..3b17643d7 100644 --- a/app/resources.cue +++ b/app/resources.cue @@ -164,8 +164,8 @@ resources: { [key=_]: {"handle": key, "component": "system", "platform": "cortez model: { attributes: { - kind: { - dal: {} + kind: { + dal: { length: 64 } } resource_id: { goType: "uint64", @@ -176,7 +176,7 @@ resources: { [key=_]: {"handle": key, "component": "system", "platform": "cortez owned_by: schema.AttributeUserRef name: { ignoreCase: true - dal: {} + dal: { length: 512 } } active: { goType: "bool" diff --git a/automation/session.cue b/automation/session.cue index 00da88f31..04958cc4f 100644 --- a/automation/session.cue +++ b/automation/session.cue @@ -10,6 +10,8 @@ session: { } model: { + // length for the lang is now a bit shorter + // Reason for that is supported index length in MySQL ident: "automation_sessions" attributes: { id: schema.IdField @@ -28,12 +30,12 @@ session: { event_type: { sortable: true, goType: "string" - dal: {} + dal: { length: 32 } } resource_type: { sortable: true, goType: "string" - dal: {} + dal: { length: 64 } } input: { goType: "*expr.Vars" diff --git a/automation/trigger.cue b/automation/trigger.cue index fcc8397cd..b5de75f68 100644 --- a/automation/trigger.cue +++ b/automation/trigger.cue @@ -34,7 +34,7 @@ trigger: { resource_type: { sortable: true, goType: "string" - dal: {} + dal: { length: 64 } } event_type: { sortable: true, diff --git a/system/resource_translation.cue b/system/resource_translation.cue index 0c158f77f..70a070a98 100644 --- a/system/resource_translation.cue +++ b/system/resource_translation.cue @@ -11,14 +11,16 @@ resource_translation: { } model: { + // lengths for the lang, resource fields are now a bit shorter + // Reason for that is supported index length in MySQL attributes: { id: schema.IdField lang: { goType: "types.Lang" - dal: { type: "Text", length: 128 } + dal: { type: "Text", length: 32 } } resource: { - dal: { type: "Text", length: 512 } + dal: { type: "Text", length: 256 } } k: { dal: { type: "Text", length: 256 } diff --git a/system/template.cue b/system/template.cue index 440d40f81..9cb45d759 100644 --- a/system/template.cue +++ b/system/template.cue @@ -6,6 +6,8 @@ import ( template: { model: { + // length for the lang is now a bit shorter + // Reason for that is supported index length in MySQL attributes: { id: schema.IdField owner_id: { @@ -17,7 +19,7 @@ template: { language: { sortable: true, goType: "string" - dal: {} + dal: { length: 32 } } type: { sortable: true,