Schema angelegt: Idempotenz-Fix, tags-Key-Index, Check-Skript

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 15:52:42 +00:00
parent a18945ce7f
commit 13bc7867cf
3 changed files with 57 additions and 1 deletions

View File

@@ -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);
}
}