feat: add publish specific locale (#7669)

## Description

1. Adds ability to publish a specific individual locale (collections and
globals)
2. Shows published locale in versions list and version comparison
3. Adds new int tests to `versions` test suite

- [X] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [X] New feature (non-breaking change which adds functionality)
- [ ] This change requires a documentation update

## Checklist:

- [X] I have added tests that prove my fix is effective or that my
feature works
- [X] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation

---------

Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
This commit is contained in:
Jessica Chowdhury
2024-09-16 16:15:29 -04:00
committed by GitHub
parent aee76cb793
commit b7a0b15786
87 changed files with 1324 additions and 141 deletions

View File

@@ -37,6 +37,7 @@ export const init: Init = function init(this: SQLiteAdapter) {
})
this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {
const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))
const config = this.payload.config
const baseExtraConfig: BaseExtraConfig = {}
@@ -51,6 +52,17 @@ export const init: Init = function init(this: SQLiteAdapter) {
}
}
if (collection.upload.filenameCompoundIndex) {
const indexName = `${tableName}_filename_compound_idx`
baseExtraConfig.filename_compound_index = (cols) => {
const colsConstraint = collection.upload.filenameCompoundIndex.map((f) => {
return cols[f]
})
return uniqueIndex(indexName).on(colsConstraint[0], ...colsConstraint.slice(1))
}
}
buildTable({
adapter: this,
disableNotNull: !!collection?.versions?.drafts,
@@ -66,7 +78,7 @@ export const init: Init = function init(this: SQLiteAdapter) {
const versionsTableName = this.tableNameMap.get(
`_${toSnakeCase(collection.slug)}${this.versionsSuffix}`,
)
const versionFields = buildVersionCollectionFields(collection)
const versionFields = buildVersionCollectionFields(config, collection)
buildTable({
adapter: this,
@@ -105,7 +117,8 @@ export const init: Init = function init(this: SQLiteAdapter) {
versions: true,
versionsCustomName: true,
})
const versionFields = buildVersionGlobalFields(global)
const config = this.payload.config
const versionFields = buildVersionGlobalFields(config, global)
buildTable({
adapter: this,