@tanglemedia/directus-collection-modal
Version:
Installs the Modal Collection to your Directus project.
73 lines (70 loc) • 2.19 kB
JavaScript
const MODAL_TABLE_NAME = "tngl_modal";
export async function up(knex) {
// reorder modal fields
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "id")
.update({ sort: 1 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "enable")
.update({ sort: 2 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "type")
.update({ sort: 3 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "timeout")
.update({ sort: 4 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "heading")
.update({ sort: 5 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "content")
.update({ sort: 6 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "image")
.update({ sort: 7 });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "buttons")
.update({ sort: 8 });
}
export async function down(knex) {
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "id")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "enable")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "type")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "timeout")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "heading")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "content")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "image")
.update({ sort: null });
await knex("directus_fields")
.where("collection", MODAL_TABLE_NAME)
.andWhere("field", "buttons")
.update({ sort: null });
}