Skip to content

[multi-tenant + slug]: slug field is set as unique but it should be a unique compound index for collections with multi tenant enabled #14801

@llaz00

Description

@llaz00

Describe the Bug

Slug field is set as unique in payload code (

).
If you use it in a multi tenant collection you can't create the same slug for different tenants.

The slug should be unique as a compound index with the tenant field.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload

Reproduction Steps

  1. Install/configure multi tenancy plugin
  2. Create a collection with a slug field
  3. Create 2 different tenants
  4. Try to use the same slug for both tenants

Which area(s) are affected? (Select all that apply)

plugin: multi-tenant

Environment Info

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions