From 98d47d0dd0ed3f79f19c5646a73983ebf5a5092a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 25 May 2026 19:02:12 +0200 Subject: [PATCH] i18n - docs translations (#20893) Created by Github action Co-authored-by: github-actions --- .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ .../developers/extend/apps/data/overview.mdx | 47 ++++++++++++++++++- .../data-model/capabilities/fields.mdx | 4 ++ 12 files changed, 300 insertions(+), 6 deletions(-) diff --git a/packages/twenty-docs/l/de/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/de/developers/extend/apps/data/overview.mdx index 0664fb83c4..3cb243eccf 100644 --- a/packages/twenty-docs/l/de/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/de/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ Die **Datenebene** einer Twenty-App umfasst die Daten, die Ihre App zu einem Wor | **Objekt** | Ein neuer benutzerdefinierter Datensatztyp (z. B. PostCard, Invoice) mit eigenen Feldern | `defineObject()` | | **Feld** | Eine Spalte in einem Objekt. Eigenständige Felder können Objekte erweitern, die Sie nicht erstellt haben (z. B. `loyaltyTier` zu Company hinzufügen) | `defineField()` | | **Beziehung** | Eine bidirektionale Verknüpfung zwischen zwei Objekten – beide Seiten werden als Felder deklariert | `defineField()` mit `FieldType.RELATION` | +| **Indizes** | Ein Datenbankindex, um eine wiederkehrende Abfrage für eines Ihrer Objekte zu beschleunigen | `defineIndex()` | -Das SDK erkennt diese zur Build-Zeit über eine AST-Analyse, sodass die Dateiorganisation Ihnen überlassen ist – die Konvention ist `src/objects/` und `src/fields/`. Stabile `universalIdentifier`-UUIDs verknüpfen alles über Deploys hinweg. +Das SDK erkennt diese zur Build-Zeit über eine AST-Analyse, sodass die Dateiorganisation Ihnen überlassen ist – die Konvention ist `src/objects/`, `src/fields/` und `src/indexes/`. Stabile `universalIdentifier`-UUIDs verknüpfen alles über Deploys hinweg. + +## Indizes (optional) + +Apps können Indizes gemeinsam mit ihren Objekten ausliefern, um wiederkehrende Abfragen schnell zu halten. Der häufigste Fall ist eine Status- oder Fremdschlüsselspalte, die Sie häufig lesen. + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### Eindeutige Indizes + +`defineIndex` akzeptiert `isUnique: true` sowohl für Einspalten- als auch Mehrspalteneindeutigkeit. Dies ist das empfohlene Primitive – `defineField({ isUnique: true })` ist veraltet und wird in einer zukünftigen Version entfernt. + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### Andere Einschränkungen + +* Partielle `WHERE`-Klauseln bleiben unter Kontrolle der Administratoren – Apps können sie nicht deklarieren. +* Jedes Objekt ist auf 10 benutzerdefinierte Indizes begrenzt (die Indizes des Frameworks selbst werden nicht mitgezählt). + +Ordnen Sie das `fields`-Array so an, wie Postgres es verwenden soll – die ganz linke Spalte zuerst, wie in einem Telefonbuch. Indizes sind nicht kostenlos: Jeder Schreibvorgang in die Tabelle aktualisiert sie. Fügen Sie einen nur dann hinzu, wenn Sie eine Abfrage haben, die ihn benötigt. Suchen Sie nach **Application Config** oder **Roles & Permissions**? Diese beschreiben die App selbst und nicht die Daten, die sie hinzufügt – sie befinden sich unter [Config](/l/de/developers/extend/apps/config/overview). Suchen Sie nach **Connections** (Linear, GitHub, Slack OAuth)? Diese existieren, um *von* Logikfunktionen aufgerufen zu werden, und befinden sich unter [Logic](/l/de/developers/extend/apps/logic/connections). diff --git a/packages/twenty-docs/l/de/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/de/user-guide/data-model/capabilities/fields.mdx index 42f1c6757d..7be4a6f10f 100644 --- a/packages/twenty-docs/l/de/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/de/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Machen Sie ein Feld einzigartig, um sicherzustellen, dass sich keine verschieden Wenn beim Einstellen der Einzigartigkeit ein Fehler auftritt, überprüfen Sie auf doppelte Werte in Ihren Daten (einschließlich gelöschter Datensätze). +## Indizes (Erweitert) + +Datenbankindizes werden automatisch verwaltet – eigene hinzuzufügen ist selten notwendig und leicht falsch zu machen. Mit aktiviertem Erweiterten Modus hat jedes Objekt einen Abschnitt **Indexes** unter `Settings → Data Model → ` für die Fälle, in denen du weißt, dass du einen brauchst. + ## Beste Praktiken zur Feldkonfiguration ### Benennungskonventionen und Einschränkungen diff --git a/packages/twenty-docs/l/pt/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/pt/developers/extend/apps/data/overview.mdx index f1eed5ed80..e739df1ca5 100644 --- a/packages/twenty-docs/l/pt/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/pt/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ A **camada de dados** de um app Twenty é o conjunto de dados que seu app *adici | **Objeto** | Um novo tipo de registro personalizado (por exemplo, PostCard, Invoice) com seus próprios campos | `defineObject()` | | **Campo** | Uma coluna em um objeto. Campos independentes podem estender objetos que você não criou (por exemplo, adicionar `loyaltyTier` ao objeto Company) | `defineField()` | | **Relação** | Um vínculo bidirecional entre dois objetos — ambos os lados declarados como campos | `defineField()` com `FieldType.RELATION` | +| **Índice** | Um índice de banco de dados para acelerar uma consulta recorrente em um dos seus objetos | `defineIndex()` | -O SDK detecta esses elementos por meio de análise de AST em tempo de build, então a organização dos arquivos fica a seu critério — a convenção é `src/objects/` e `src/fields/`. UUIDs `universalIdentifier` estáveis conectam tudo em implantações diferentes. +O SDK detecta esses elementos por meio de análise de AST em tempo de build, então a organização dos arquivos fica a seu critério — a convenção é `src/objects/`, `src/fields/` e `src/indexes/`. UUIDs `universalIdentifier` estáveis conectam tudo em implantações diferentes. + +## Índices (Opcional) + +Os apps podem incluir índices junto com seus objetos para manter rápidas as consultas recorrentes. O caso mais comum é uma coluna de status ou de chave estrangeira que você lê com frequência. + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### Índices únicos + +`defineIndex` aceita `isUnique: true` tanto para unicidade de uma única coluna quanto de múltiplas colunas. Este é o recurso recomendado — `defineField({ isUnique: true })` está obsoleto e será removido em uma versão futura. + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### Outras restrições + +* Cláusulas `WHERE` parciais permanecem sob controle do administrador — os apps não podem declará-las. +* Cada objeto é limitado a 10 índices personalizados (os índices do próprio framework não contam). + +Ordene o array `fields` da forma como o Postgres deve usá-lo — coluna mais à esquerda primeiro, como em uma lista telefônica. Índices não são gratuitos: cada gravação na tabela os atualiza. Adicione um apenas quando você tiver uma consulta que precise dele. Procurando por **Application Config** ou **Roles & Permissions**? Esses descrevem o próprio app em vez dos dados que ele adiciona — eles ficam em [Config](/l/pt/developers/extend/apps/config/overview). Procurando por **Connections** (Linear, GitHub, Slack OAuth)? Essas existem para serem chamadas *a partir de* funções de lógica e ficam em [Logic](/l/pt/developers/extend/apps/logic/connections). diff --git a/packages/twenty-docs/l/pt/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/pt/user-guide/data-model/capabilities/fields.mdx index faf37537f5..8922de5886 100644 --- a/packages/twenty-docs/l/pt/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/pt/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Torne um campo único para garantir que registros distintos não possam ter o me Se você receber um erro ao definir exclusividade, verifique se há valores duplicados nos seus dados (incluindo registros excluídos). +## Índices (Avançado) + +Os índices do banco de dados são gerenciados automaticamente — adicionar os seus próprios raramente é necessário e é fácil cometer erros. Com o modo Avançado ativado, cada objeto tem uma seção **Índices** em `Settings → Data Model → ` para os casos em que você sabe que precisa de um índice. + ## Melhores Práticas de Configuração de Campos ### Convenções de Nomeação e Limitações diff --git a/packages/twenty-docs/l/ro/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/ro/developers/extend/apps/data/overview.mdx index 67e2b8677b..50fb6ad3a9 100644 --- a/packages/twenty-docs/l/ro/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/ro/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ Stratul de **date** al unei aplicații Twenty reprezintă datele pe care aplica | **Obiect** | Un nou tip de înregistrare personalizat (de ex. PostCard, Invoice) cu propriile sale câmpuri | `defineObject()` | | **Câmp** | O coloană pe un obiect. Câmpurile independente pot extinde obiecte pe care nu le-ați creat (de ex. adăugați `loyaltyTier` la Company) | `defineField()` | | **Relație** | O legătură bidirecțională între două obiecte — ambele părți declarate ca câmpuri | `defineField()` cu `FieldType.RELATION` | +| **Indice** | Un indice de bază de date pentru a accelera o interogare recurentă asupra unuia dintre obiectele tale | `defineIndex()` | -SDK-ul detectează acestea prin analiza AST la momentul build-ului, astfel încât organizarea fișierelor ține de dumneavoastră — convenția este `src/objects/` și `src/fields/`. UUID-urile stabile `universalIdentifier` leagă totul în toate implementările. +SDK-ul detectează acestea prin analiza AST la momentul build-ului, astfel încât organizarea fișierelor ține de tine — convenția este `src/objects/`, `src/fields/` și `src/indexes/`. UUID-urile stabile `universalIdentifier` leagă totul în toate implementările. + +## Indici (opțional) + +Aplicațiile pot livra indici împreună cu obiectele lor pentru a menține rapide interogările recurente. Cel mai comun caz este o coloană de status sau o coloană cu cheie străină pe care o citești frecvent. + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### Indici unici + +`defineIndex` acceptă `isUnique: true` atât pentru unicitatea pe o singură coloană, cât și pe mai multe coloane. Aceasta este primitiva recomandată — `defineField({ isUnique: true })` este învechită (deprecated) și va fi eliminată într-o versiune viitoare. + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### Alte constrângeri + +* Clauzele `WHERE` parțiale rămân sub controlul administratorului — aplicațiile nu le pot declara. +* Fiecare obiect este limitat la 10 indici personalizați (indicii proprii ai framework-ului nu se pun la socoteală). + +Ordonează array-ul `fields` în modul în care Postgres ar trebui să îl folosească — coloana din stânga prima, ca într-o agendă telefonică. Indicii nu sunt gratuiți: fiecare scriere în tabel îi actualizează. Adaugă unul doar atunci când ai o interogare care are nevoie de el. Căutați **Application Config** sau **Roles & Permissions**? Acestea descriu aplicația în sine, mai degrabă decât datele pe care le adaugă — se află la [Config](/l/ro/developers/extend/apps/config/overview). Căutați **Connections** (Linear, GitHub, Slack OAuth)? Acestea există pentru a fi apelate *din* funcții de logică și se află la [Logic](/l/ro/developers/extend/apps/logic/connections). diff --git a/packages/twenty-docs/l/ro/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/ro/user-guide/data-model/capabilities/fields.mdx index a6302d06d1..34be4ded2f 100644 --- a/packages/twenty-docs/l/ro/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/ro/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Faceți un câmp unic pentru a vă asigura că înregistrările distincte nu pot Dacă primiți o eroare când setați unicitatea, verificați prezența valorilor duplicate în datele dumneavoastră (inclusiv în cele șterse). +## Indexuri (Avansat) + +Indexurile bazei de date sunt gestionate automat — adăugarea unor indexuri proprii este rareori necesară și se greșește ușor. Cu modul Avansat activat, fiecare obiect are o secțiune **Indexuri** sub `Settings → Data Model → ` pentru cazurile în care știi că ai nevoie de unul. + ## Cele mai bune practici pentru configurarea câmpurilor ### Convenții de denumire și limitări diff --git a/packages/twenty-docs/l/ru/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/ru/developers/extend/apps/data/overview.mdx index 63be0ded9b..05043cbd94 100644 --- a/packages/twenty-docs/l/ru/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/ru/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ icon: database | **Объект** | Новый пользовательский тип записей (например, PostCard, Invoice) с собственными полями | `defineObject()` | | **Поле** | Столбец в объекте. Отдельные поля могут расширять объекты, которые вы не создавали (например, добавьте `loyaltyTier` к объекту Company) | `defineField()` | | **Связь** | Двусторонняя связь между двумя объектами — обе стороны объявлены как поля | `defineField()` с `FieldType.RELATION` | +| **Индекс** | Индекс базы данных для ускорения повторяющегося запроса к одному из ваших объектов | `defineIndex()` | -SDK обнаруживает их с помощью анализа AST во время сборки, поэтому организация файлов остается на ваше усмотрение — по соглашению используются `src/objects/` и `src/fields/`. Стабильные UUID `universalIdentifier` связывают все воедино между развертываниями. +SDK обнаруживает их с помощью анализа AST во время сборки, поэтому организация файлов остается на ваше усмотрение — по соглашению используются `src/objects/`, `src/fields/` и `src/indexes/`. Стабильные UUID `universalIdentifier` связывают все воедино между развертываниями. + +## Индексы (необязательно) + +Приложения могут поставлять индексы вместе со своими объектами, чтобы повторяющиеся запросы выполнялись быстро. Наиболее распространенный случай — столбец статуса или внешнего ключа, к которому вы часто обращаетесь при чтении. + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### Уникальные индексы + +`defineIndex` принимает `isUnique: true` как для уникальности по одному столбцу, так и по нескольким столбцам. Это рекомендуемый примитив — `defineField({ isUnique: true })` устарел и будет удален в одном из будущих релизов. + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### Другие ограничения + +* Частичные предложения `WHERE` остаются под контролем администратора — приложения не могут объявлять их. +* Для каждого объекта допускается не более 10 пользовательских индексов (индексы самого фреймворка не учитываются). + +Упорядочьте массив `fields` в том порядке, в котором Postgres должен его использовать — сначала самый левый столбец, как в телефонной книге. Индексы не бесплатны: при каждой записи в таблицу они обновляются. Добавляйте индекс только тогда, когда у вас есть запрос, которому он действительно нужен. Ищете **Application Config** или **Roles & Permissions**? Они описывают само приложение, а не данные, которые оно добавляет, — их можно найти в разделе [Config](/l/ru/developers/extend/apps/config/overview). Ищете **Connections** (Linear, GitHub, Slack OAuth)? Они существуют для вызова *из* логических функций и находятся в разделе [Logic](/l/ru/developers/extend/apps/logic/connections). diff --git a/packages/twenty-docs/l/ru/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/ru/user-guide/data-model/capabilities/fields.mdx index 5f80eb8e5d..08b493abb5 100644 --- a/packages/twenty-docs/l/ru/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/ru/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Twenty поддерживает различные типы полей: Если вы получаете ошибку при установке уникальности, проверьте дублирующиеся значения в ваших данных (включая удаленные записи). +## Индексы (расширенный режим) + +Индексы базы данных управляются автоматически — добавлять собственные почти никогда не требуется и при этом легко допустить ошибку. При включенном расширенном режиме у каждого объекта есть раздел **Индексы** в `Settings → Data Model → ` для случаев, когда вы знаете, что вам нужен индекс. + ## Лучшие практики в настройке полей ### Именование и ограничения diff --git a/packages/twenty-docs/l/tr/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/tr/developers/extend/apps/data/overview.mdx index 68a6bb03dd..7e0d33f2e4 100644 --- a/packages/twenty-docs/l/tr/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/tr/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ Bir Twenty uygulamasının **veri katmanı**, uygulamanızın bir çalışma ala | **Nesne** | Kendi alanlarına sahip yeni bir özel kayıt türü (ör. PostCard, Invoice) | `defineObject()` | | **Alan** | Bir nesne üzerindeki sütun. Bağımsız alanlar, oluşturmadığınız nesneleri genişletebilir (ör. Company nesnesine `loyaltyTier` ekleyin) | `defineField()` | | **İlişki** | İki nesne arasında, her iki tarafı da alan olarak bildirilmiş çift yönlü bir bağlantı | `defineField()` ile `FieldType.RELATION` | +| **Dizin** | Nesnelerinizden biri üzerinde yinelenen bir sorguyu hızlandırmak için bir veritabanı dizini | `defineIndex()` | -SDK bunları derleme zamanında AST analiziyle algılar, bu yüzden dosya organizasyonu size kalmıştır — kullanılan gelenek `src/objects/` ve `src/fields/` dizinleridir. Kararlı `universalIdentifier` UUID’leri, dağıtımlar arasında her şeyi birbirine bağlar. +SDK bunları derleme zamanında AST analiziyle algılar, bu yüzden dosya organizasyonu size kalmıştır — kullanılan gelenek `src/objects/`, `src/fields/` ve `src/indexes/` dizinleridir. Kararlı `universalIdentifier` UUID’leri, dağıtımlar arasında her şeyi birbirine bağlar. + +## Dizinler (İsteğe bağlı) + +Uygulamalar, yinelenen sorguları hızlı tutmak için nesneleriyle birlikte dizinler sunabilir. En yaygın durum, sık okuduğunuz bir durum ya da yabancı anahtar sütunudur. + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### Benzersiz dizinler + +`defineIndex`, hem tek sütunlu hem çok sütunlu benzersizlik için `isUnique: true` kabul eder. Önerilen yöntem budur — `defineField({ isUnique: true })` kullanımdan kaldırılmıştır ve gelecekteki bir sürümde kaldırılacaktır. + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### Diğer kısıtlamalar + +* Kısmi `WHERE` koşulları yönetici kontrolü altında kalır — uygulamalar bunları tanımlayamaz. +* Her nesne, 10 özel dizin ile sınırlandırılmıştır (framework'ün kendi dizinleri buna dahil değildir). + +`fields` dizisini, Postgres'in kullanması gereken şekilde sıralayın — en soldaki sütun ilk, bir telefon rehberinde olduğu gibi. Dizinler bedava değildir: tabloya yapılan her yazma işlemi bunları günceller. Bir dizini yalnızca ona ihtiyaç duyan bir sorgunuz olduğunda ekleyin. **Application Config** veya **Roles & Permissions** mı arıyorsunuz? Bunlar, ekledikleri verilerden çok uygulamanın kendisini tanımlar — [Config](/l/tr/developers/extend/apps/config/overview) altında bulunurlar. **Connections** (Linear, GitHub, Slack OAuth) mı arıyorsunuz? Bunlar, mantık fonksiyonları *içinden* çağrılmak için vardır ve [Logic](/l/tr/developers/extend/apps/logic/connections) altında bulunurlar. diff --git a/packages/twenty-docs/l/tr/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/tr/user-guide/data-model/capabilities/fields.mdx index 4455676297..a6f427acd4 100644 --- a/packages/twenty-docs/l/tr/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/tr/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Farklı kayıtların aynı değere sahip olamaması için bir alanı benzersiz y Benzersizliği ayarlarken bir hata alırsanız, verilerinizde (silinen kayıtlar dahil) yinelenen değerleri kontrol edin. +## Dizinler (Gelişmiş) + +Veritabanı dizinleri otomatik olarak yönetilir — kendi dizinlerinizi eklemeniz nadiren gereklidir ve yanlış yapmak da kolaydır. Gelişmiş mod açıkken, bir dizine ihtiyacınız olduğunu bildiğiniz durumlar için her nesnenin `Ayarlar → Veri Modeli → ` altında bir **Dizinler** bölümü bulunur. + ## Alan Yapılandırma En İyi Uygulamaları ### Adlandırma Kuralları ve Kısıtlamaları diff --git a/packages/twenty-docs/l/zh/developers/extend/apps/data/overview.mdx b/packages/twenty-docs/l/zh/developers/extend/apps/data/overview.mdx index fd48c44743..8cdcf879e4 100644 --- a/packages/twenty-docs/l/zh/developers/extend/apps/data/overview.mdx +++ b/packages/twenty-docs/l/zh/developers/extend/apps/data/overview.mdx @@ -44,8 +44,53 @@ Twenty 应用的 **数据层(data layer)** 是你的应用*添加*到工作 | **对象** | 具有自有字段的新自定义记录类型(例如 PostCard、Invoice) | `defineObject()` | | **字段** | 对象上的一列。 独立字段可以扩展你未创建的对象(例如向 Company 添加 `loyaltyTier`) | `defineField()` | | **关系** | 两个对象之间的双向链接——双方都声明为字段 | 使用 `defineField()` 并指定 `FieldType.RELATION` | +| **索引** | 用于加速在某个对象上经常执行的查询的数据库索引 | `defineIndex()` | -SDK 会在构建时通过 AST 分析检测这些内容,因此文件组织方式由你决定——约定是使用 `src/objects/` 和 `src/fields/`。 稳定的 `universalIdentifier` UUID 在不同部署之间将一切关联在一起。 +SDK 会在构建时通过 AST 分析检测这些内容,因此文件组织方式由你决定——约定是使用 `src/objects/`、`src/fields/` 和 `src/indexes/`。 稳定的 `universalIdentifier` UUID 在不同部署之间将一切关联在一起。 + +## 索引(可选) + +应用可以随对象一同提供索引,以确保经常执行的查询保持快速。 最常见的情况是某个你经常读取的状态列或外键列。 + +```ts src/indexes/post-card-status.index.ts +import { defineIndex } from 'twenty-sdk/define'; + +import { + POST_CARD_UNIVERSAL_IDENTIFIER, + STATUS_FIELD_UNIVERSAL_IDENTIFIER, +} from '../objects/post-card.object'; + +export default defineIndex({ + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff0', + objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER, + fields: [ + { + universalIdentifier: 'b6e9d2a1-5a4c-46ca-9d52-42c8f02d1ff1', + fieldUniversalIdentifier: STATUS_FIELD_UNIVERSAL_IDENTIFIER, + }, + ], +}); +``` + +### 唯一索引 + +`defineIndex` 接受 `isUnique: true`,可同时用于单列和多列表达唯一性约束。 这是推荐的基础方式——`defineField({ isUnique: true })` 已被弃用,并将在未来的版本中移除。 + +```ts +defineIndex({ + universalIdentifier: '…', + objectUniversalIdentifier: PERSON_UNIVERSAL_IDENTIFIER, + isUnique: true, + fields: [{ universalIdentifier: '…', fieldUniversalIdentifier: EMAIL_FIELD_UNIVERSAL_IDENTIFIER }], +}); +``` + +### 其他约束 + +* 部分 `WHERE` 子句由管理员控制——应用无法声明它们。 +* 每个对象最多只能有 10 个自定义索引(框架自身的索引不计入其中)。 + +按照 Postgres 使用索引的方式来排列 `fields` 数组——最左边的列放在最前面,就像电话簿一样。 索引不是免费的:对表的每一次写入都会更新索引。 只有当你确实有查询需要某个索引时才添加它。 在找 **Application Config** 或 **Roles & Permissions** 吗? 这些描述的是应用本身而不是它添加的数据——相关内容位于 [Config](/l/zh/developers/extend/apps/config/overview) 下。 在找 **Connections**(Linear、GitHub、Slack OAuth)吗? 这些用于*从*逻辑函数中调用,并位于 [Logic](/l/zh/developers/extend/apps/logic/connections) 下。 diff --git a/packages/twenty-docs/l/zh/user-guide/data-model/capabilities/fields.mdx b/packages/twenty-docs/l/zh/user-guide/data-model/capabilities/fields.mdx index 7bbf3b103f..4c1f617084 100644 --- a/packages/twenty-docs/l/zh/user-guide/data-model/capabilities/fields.mdx +++ b/packages/twenty-docs/l/zh/user-guide/data-model/capabilities/fields.mdx @@ -101,6 +101,10 @@ Twenty 支持多种字段类型: 如果在设置唯一性时出现错误,请检查数据中是否有重复值(包括删除的记录)。 +## 索引(高级) + +数据库索引由系统自动管理——自己添加索引通常没必要,而且也很容易出错。 在开启高级模式后,每个对象在 `Settings → Data Model → ` 下都会有一个 **Indexes** 部分,供你在确实需要索引时使用。 + ## 字段配置最佳实践 ### 命名约定和限制