import type { Knex } from 'knex';

/**
 * SEO Phase 10: every uploaded image keeps its resized copies (e.g. 200w / 400w / 800w WebP made in the
 * admin) for srcset: [{ key, url, width, height }]. width/height on the row are the main (largest) copy.
 */
export async function up(knex: Knex): Promise<void> {
  await knex.schema.alterTable('images', (t) => {
    t.json('variants').nullable();
  });
}

export async function down(knex: Knex): Promise<void> {
  await knex.schema.alterTable('images', (t) => {
    t.dropColumn('variants');
  });
}
