Fix media uploads without alt text
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||
|
||||
/** Allows image uploads without requiring accessibility metadata at upload time. */
|
||||
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "media" ALTER COLUMN "alt" DROP NOT NULL;
|
||||
`);
|
||||
}
|
||||
|
||||
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
UPDATE "media" SET "alt" = '' WHERE "alt" IS NULL;
|
||||
ALTER TABLE "media" ALTER COLUMN "alt" SET NOT NULL;
|
||||
`);
|
||||
}
|
||||
Reference in New Issue
Block a user