fix(drizzle): indexes / unique with relationships (#8432)
Fixes https://github.com/payloadcms/payload/issues/8413 and https://github.com/payloadcms/payload/issues/6460 - Builds indexes for relationships by default in the SQL schema - Fixes `unique: true` handling with Postgres / SQLite for every type of relationships (non-polymorphic. hasMany, polymorphic, polymorphic hasMany) _note_: disables unique for nested to arrays / blocks relationships in the `_rels` table. - adds tests 2.0 PR tha ports only indexes creation https://github.com/payloadcms/payload/pull/8446, because `unique: true` could be a breaking change if someone has incosistent unique data in the database.
This commit is contained in:
@@ -1020,6 +1020,29 @@ export interface IndexedField {
|
||||
id: string;
|
||||
text: string;
|
||||
uniqueText?: string | null;
|
||||
uniqueRelationship?: (string | null) | TextField;
|
||||
uniqueHasManyRelationship?: (string | TextField)[] | null;
|
||||
uniqueHasManyRelationship_2?: (string | TextField)[] | null;
|
||||
uniquePolymorphicRelationship?: {
|
||||
relationTo: 'text-fields';
|
||||
value: string | TextField;
|
||||
} | null;
|
||||
uniquePolymorphicRelationship_2?: {
|
||||
relationTo: 'text-fields';
|
||||
value: string | TextField;
|
||||
} | null;
|
||||
uniqueHasManyPolymorphicRelationship?:
|
||||
| {
|
||||
relationTo: 'text-fields';
|
||||
value: string | TextField;
|
||||
}[]
|
||||
| null;
|
||||
uniqueHasManyPolymorphicRelationship_2?:
|
||||
| {
|
||||
relationTo: 'text-fields';
|
||||
value: string | TextField;
|
||||
}[]
|
||||
| null;
|
||||
uniqueRequiredText: string;
|
||||
localizedUniqueRequiredText: string;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user