Schema angelegt: Idempotenz-Fix, tags-Key-Index, Check-Skript
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,7 +162,8 @@ const TABLES = [
|
||||
{ key: 'idx_topn', type: 'key', columns: ['brand_id', 'category_id', 'status', 'score'], orders: ['ASC', 'ASC', 'ASC', 'DESC'] },
|
||||
{ key: 'idx_parent', type: 'key', columns: ['parent_id'] },
|
||||
{ key: 'idx_slug', type: 'key', columns: ['brand_id', 'slug'] },
|
||||
{ key: 'ft_tags', type: 'fulltext', columns: ['tags'], optional: true },
|
||||
// Fulltext ist auf Array-Spalten verboten → Key-Index (reicht für Query.contains)
|
||||
{ key: 'idx_tags', type: 'key', columns: ['tags'] },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -340,6 +341,10 @@ async function main() {
|
||||
rowSecurity: t.rowSecurity,
|
||||
});
|
||||
for (const c of t.columns) {
|
||||
// Erst GET: Appwrite prüft das Zeilengrößen-Limit VOR dem Duplikat-Check,
|
||||
// ein erneutes POST auf große Spalten gäbe sonst 400 statt 409.
|
||||
const { status } = await api('GET', `/tablesdb/${DB_ID}/tables/${t.id}/columns/${c.body.key}`);
|
||||
if (status === 200) { skipped++; console.log(` = ${t.id}.${c.body.key} (existiert)`); continue; }
|
||||
await ensure(`${t.id}.${c.body.key}`, 'POST', `/tablesdb/${DB_ID}/tables/${t.id}/columns/${c.type}`, c.body);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user