UNPKG

@alsew_/strapi-plugin-migration

Version:
30 lines (29 loc) 946 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ({ strapi }) => ({ async get() { const knex = strapi.db?.connection; const [migrationConfig] = (await knex?.('cms_migrations_config').where({ id: 1, })) ?? []; return { ...migrationConfig, is_dev: process.env.NODE_ENV === 'development', }; }, async toggleDryMode() { const knex = strapi.db?.connection; // Get initial value const [migrationConfig] = (await knex?.('cms_migrations_config').where({ id: 1, })) ?? []; const [migrationConfigUpdate] = (await knex?.('cms_migrations_config') .update({ active_dry_mode: !migrationConfig.active_dry_mode, }, ['active_dry_mode']) .where({ id: 1, })) ?? []; return migrationConfigUpdate; }, });