mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 18:34:13 +00:00
fix: add missing social_platforms columns (oauthEndpoint, tokenValidityDays)
The SocialPlatforms collection config had apiConfig.oauthEndpoint and apiConfig.tokenValidityDays fields that were never migrated to the DB. This caused a DrizzleQueryError when resolving social_platforms relationships (e.g. creating community-interactions), since the SQL query referenced non-existent columns. Applied to both dev and production databases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ddeb387143
commit
d39cb1cd23
2 changed files with 34 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
/**
|
||||
* Add missing columns to social_platforms table.
|
||||
*
|
||||
* The SocialPlatforms collection config has apiConfig.oauthEndpoint and
|
||||
* apiConfig.tokenValidityDays fields that were added after the initial
|
||||
* community phase1 migration but never migrated to the DB.
|
||||
*
|
||||
* Without these columns, any query that resolves social_platforms relationships
|
||||
* (e.g. creating community-interactions) fails with:
|
||||
* "column social_platforms.api_config_oauth_endpoint does not exist"
|
||||
*/
|
||||
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "social_platforms"
|
||||
ADD COLUMN IF NOT EXISTS "api_config_oauth_endpoint" varchar,
|
||||
ADD COLUMN IF NOT EXISTS "api_config_token_validity_days" numeric DEFAULT 60;
|
||||
`)
|
||||
}
|
||||
|
||||
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "social_platforms"
|
||||
DROP COLUMN IF EXISTS "api_config_oauth_endpoint",
|
||||
DROP COLUMN IF EXISTS "api_config_token_validity_days";
|
||||
`)
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ import * as migration_20260215_120000_add_monitoring_collections from './2026021
|
|||
import * as migration_20260216_150000_add_card_grid_icon_fields from './20260216_150000_add_card_grid_icon_fields';
|
||||
import * as migration_20260217_120000_add_tenant_to_forms from './20260217_120000_add_tenant_to_forms';
|
||||
import * as migration_20260228_150000_add_html_embed_block from './20260228_150000_add_html_embed_block';
|
||||
import * as migration_20260302_180000_add_social_platforms_missing_columns from './20260302_180000_add_social_platforms_missing_columns';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -246,4 +247,9 @@ export const migrations = [
|
|||
down: migration_20260228_150000_add_html_embed_block.down,
|
||||
name: '20260228_150000_add_html_embed_block'
|
||||
},
|
||||
{
|
||||
up: migration_20260302_180000_add_social_platforms_missing_columns.up,
|
||||
down: migration_20260302_180000_add_social_platforms_missing_columns.down,
|
||||
name: '20260302_180000_add_social_platforms_missing_columns'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue