mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-18 01:34:11 +00:00
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>
55 lines
1.7 KiB
TypeScript
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";
|
|
`)
|
|
}
|