#Issue with unique constraint on localized table fields

2 messages · Page 1 of 1 (latest)

narrow raft
#

As I mentioned in another thread (#1318751248962551808 messagep) , I cannot validate Drizzle prompts in console, which is becoming quite the pain.

I usually bypass this by deleted the table in Postgre, but in this case, the prompt does not go away :

You're about to add lessons_blocks_tableau_rows_columns_locales_locale_parent_id_unique unique constraint to the table, which contains 9 items. If this statement fails, you will receive an error from the database. Do you want to truncate lessons_blocks_tableau_rows_columns_locales table?

I tried this also :

TRUNCATE TABLE lessons_blocks_tableau_rows_columns_locales;

Code
`import type { Block } from 'payload';
import jsonToTable from '@/hooks/jsonToTable';

const tableau: Block = {
slug: 'tableau',
labels: {
singular: 'Tableau',
plural: 'Tableaux',
},
fields: [
{
name: 'jsonData',
label: 'Tableau (JSON)',
type: 'code',
admin: {
language: 'json',
},
hooks: {
beforeChange: [jsonToTable],
}
},
{
name: 'hasHeaders',
label: 'Le tableau a des en-têtes',
type: 'checkbox',
defaultValue: false,
},
{
name: 'rows',
type: 'array',
admin: {
initCollapsed: true,
},
fields: [
{
name: 'columns',
type: 'array',
fields: [
{
name: 'cell',
type: 'text',
label: 'Cellule',
localized: true,
},
],
label: 'Colonnes',
},
],
label: 'Lignes',
}
],
};

export default tableau;`

Does someone please has a clue ?
I get this pretty much every time I'm adding a new block, but I managed to "fix it" deleting tables for Payload to reconstruct them.
This time I'm stuck.

Thanks

fossil driftBOT