exports.up = async (knex) => {
  return knex.schema.alterTable('media', (table) => {
    table.string("title");
    table.string("tags").notNullable().default("");
    table.integer("views").default(0);
    table.string("description");
    table.string("codec_name", 20);
    table.integer("width").notNullable().default(0);
    table.integer("height").notNullable().default(0);
    table.float("duration").notNullable().default(0.0);
    table.enum("state", ["new", "edited", "published"]).defaultTo("new");
    table.string("aspect_ratio", 10).notNullable().default("16/9");
    table.unique("src");
  });
}

exports.down = async (knex) => {
  return knex.schema.alterTable('media', (table) => {
    table.dropColumn("title");
    table.dropColumn("tags");
    table.dropColumn("views");
    table.dropColumn("description");
    table.dropColumn("codec_name");
    table.dropColumn("width");
    table.dropColumn("height");
    table.dropColumn("duration");
    table.dropColumn("state");
    table.dropColumn("aspect_ratio");
    table.dropUnique("src");
  });
}
