Browse Source

Need these files for the improved media usage.

master
Zed A. Shaw 1 week ago
parent
commit
1e3960caa4
  1. 31
      migrations/20211111034030_media_meta_fields.cjs
  2. 15
      migrations/20211122202014_media_add_slug.cjs

31
migrations/20211111034030_media_meta_fields.cjs

@ -0,0 +1,31 @@
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");
});
}

15
migrations/20211122202014_media_add_slug.cjs

@ -0,0 +1,15 @@
exports.up = async (knex) => {
// using async/await lets you work with multiple tables in one up/down
await knex.schema.alterTable('media', (table) => {
table.string("slug");
});
// because this is an async it'll automatically be a promise for knex
// add any other tables here with an await, no need to return
}
exports.down = async (knex) => {
await knex.schema.alterTable('media', (table) => {
table.dropColumn("slug");
});
}
Loading…
Cancel
Save