/**
 * media_categories — PLANNING.md §6c, verbatim DDL.
 * Seeded as data, not an enum (Q5), so the five labels can change without a
 * migration. Auto-increment int PK: a lookup table, not API-exposed by id.
 * Rows are inserted by seeds/01_media_categories.ts.
 */
import type { Knex } from 'knex';

export async function up(knex: Knex): Promise<void> {
  await knex.schema.raw(`
    CREATE TABLE media_categories (
      id         INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
      slug       VARCHAR(64)  NOT NULL,
      label      VARCHAR(120) NOT NULL,
      position   INT UNSIGNED NOT NULL DEFAULT 0,
      UNIQUE KEY uq_category_slug (slug)
    ) ENGINE=InnoDB
  `);
}

export async function down(knex: Knex): Promise<void> {
  await knex.schema.raw('DROP TABLE IF EXISTS media_categories');
}
