cms.c2sgmbh/src/migrations/20260113_090000_add_tenant_to_blogwoman.ts
Martin Porwoll 74b251edea feat(Community): add Community Inbox View, Rules Engine, and YouTube OAuth
Community Management Phase 1 completion:
- Add Community Inbox admin view with filters, stats, and reply functionality
- Add Rules Engine service for automated interaction processing
- Add YouTube OAuth flow (auth, callback, token refresh)
- Add Comment Sync cron job (every 15 minutes)
- Add Community Export API (PDF/Excel/CSV)
- Fix database schema for community_rules hasMany fields
- Fix access control in communityAccess.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 16:26:08 +00:00

55 lines
1.7 KiB
TypeScript

import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
/**
* Migration: Add BlogWoman collections to payload_locked_documents_rels
*
* The multi-tenant plugin handles the tenant_id column automatically.
* This migration only adds the required columns to payload_locked_documents_rels
* to prevent RSC errors when accessing these collections in the admin panel.
*/
export async function up({ db }: MigrateUpArgs): Promise<void> {
// Add favorites_id to payload_locked_documents_rels
await db.execute(sql`
ALTER TABLE "payload_locked_documents_rels"
ADD COLUMN IF NOT EXISTS "favorites_id" integer
REFERENCES favorites(id) ON DELETE CASCADE;
`)
await db.execute(sql`
CREATE INDEX IF NOT EXISTS "payload_locked_documents_rels_favorites_idx"
ON "payload_locked_documents_rels" ("favorites_id");
`)
// Add series_id to payload_locked_documents_rels
await db.execute(sql`
ALTER TABLE "payload_locked_documents_rels"
ADD COLUMN IF NOT EXISTS "series_id" integer
REFERENCES series(id) ON DELETE CASCADE;
`)
await db.execute(sql`
CREATE INDEX IF NOT EXISTS "payload_locked_documents_rels_series_idx"
ON "payload_locked_documents_rels" ("series_id");
`)
}
export async function down({ db }: MigrateDownArgs): Promise<void> {
// Remove columns in reverse order
await db.execute(sql`
DROP INDEX IF EXISTS "payload_locked_documents_rels_series_idx";
`)
await db.execute(sql`
ALTER TABLE "payload_locked_documents_rels"
DROP COLUMN IF EXISTS "series_id";
`)
await db.execute(sql`
DROP INDEX IF EXISTS "payload_locked_documents_rels_favorites_idx";
`)
await db.execute(sql`
ALTER TABLE "payload_locked_documents_rels"
DROP COLUMN IF EXISTS "favorites_id";
`)
}