Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 0 additions & 119 deletions .github/workflows/backfill-previews.yml

This file was deleted.

8 changes: 1 addition & 7 deletions CONTENT_MODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Taxonomy labels applied to posts. Source: `src/collections/Tags.ts`.

### 5) Media

Image uploads with auto-generated preview data. Source: `src/collections/Media.ts`.
Image uploads managed by Payload. Source: `src/collections/Media.ts`.

**Access:** public read; write requires authentication.

Expand All @@ -99,12 +99,6 @@ Image uploads with auto-generated preview data. Source: `src/collections/Media.t

- `alt` — text, required
- `caption` — textarea
- `lqip` — text, read-only; legacy AVIF data-URL placeholder written during the PR #140 → #246 deploy window. Transitional: will be removed once all documents have a populated `preview`. Tracked in #246.
- `preview` — group field (auto-generated content-aware preview, populated on upload or by backfill) with sub-fields:
- `color` — text, read-only; dominant color as `#rrggbb`
- `ascii` — text, read-only; 24×12 luminance halftone (288 chars, row-major)

Both `lqip` and `preview` hooks (`generateLqipHook`, `generatePreviewHook`) run on `beforeChange`. The `preview` fields are canonical post-PR-#140; `lqip` is dual-written only during the cutover window.

---

Expand Down
45 changes: 45 additions & 0 deletions migrations/20260601_000000_drop_media_lqip_preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'

/**
* Database Migration: Drop Media lqip + preview columns
*
* Removes the columns backing the now-deleted image-preview experiment from
* the `media` table:
*
* - `lqip` — legacy AVIF low-quality-image-placeholder data URL
* - `preview_color` — dominant color (`#rrggbb`) for the ASCII preview
* - `preview_ascii` — 24×12 luminance halftone (288 chars)
*
* The ASCII/LQIP placeholder experiment was removed (issue #441); heroes now
* render plain `next/image` with a CSS spinner, so none of these columns have
* a consumer. This also completes #246's "drop the lqip column".
*
* Uses DROP COLUMN IF EXISTS for idempotency — safe to run against databases
* where the columns were never added (e.g. a fresh DB created with
* `push: true`) or were already dropped manually.
*
* The existing add-column migrations (20260425_220000_add_media_lqip,
* 20260428_010142_add_media_preview) are intentionally left untouched; this is
* a new forward migration layered on top of them.
*
* Down migration: re-adds the three columns as nullable varchars (reversible
* shape-wise; the previously-stored placeholder values are not restored).
*/

export async function up({ db }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "media"
DROP COLUMN IF EXISTS "lqip",
DROP COLUMN IF EXISTS "preview_color",
DROP COLUMN IF EXISTS "preview_ascii";
`)
}

export async function down({ db }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "media"
ADD COLUMN IF NOT EXISTS "lqip" varchar,
ADD COLUMN IF NOT EXISTS "preview_color" varchar,
ADD COLUMN IF NOT EXISTS "preview_ascii" varchar;
`)
}
6 changes: 6 additions & 0 deletions migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as migration_20260425_220000_add_media_lqip from './20260425_220000_add
import * as migration_20260428_010142_add_media_preview from './20260428_010142_add_media_preview';
import * as migration_20260517_184638_dedicated_date_modified from './20260517_184638_dedicated_date_modified';
import * as migration_20260519_000221_add_posts_schema_type_and_steps from './20260519_000221_add_posts_schema_type_and_steps';
import * as migration_20260601_000000_drop_media_lqip_preview from './20260601_000000_drop_media_lqip_preview';

export const migrations = [
{
Expand Down Expand Up @@ -84,4 +85,9 @@ export const migrations = [
down: migration_20260519_000221_add_posts_schema_type_and_steps.down,
name: '20260519_000221_add_posts_schema_type_and_steps',
},
{
up: migration_20260601_000000_drop_media_lqip_preview.up,
down: migration_20260601_000000_drop_media_lqip_preview.down,
name: '20260601_000000_drop_media_lqip_preview',
},
];
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug",
"backfill:lqip": "tsx scripts/backfill-lqip.ts",
"backfill:previews": "tsx scripts/backfill-previews.ts",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down
111 changes: 0 additions & 111 deletions scripts/backfill-lqip.ts

This file was deleted.

Loading
Loading