TODO: - Allow choosing a mosaico template in a mosaico-based template - Integrate the custom mosaico templates with templates (endpoint for retrieving a mosaico template, replacement of URL_BASE and PLACEHOLDER tags - Implement support for MJML-based Mosaico templates - Implement support for MJML-based templates - Implement support for GrapeJS-based templates
25 lines
876 B
JavaScript
25 lines
876 B
JavaScript
const entityTypesWithFiles = ['template', 'campaign'];
|
|
|
|
exports.up = (knex, Promise) => (async() => {
|
|
for (const entityType of entityTypesWithFiles) {
|
|
|
|
await knex.schema.createTable(`files_${entityType}`, table => {
|
|
table.increments('id').primary();
|
|
table.integer('entity').unsigned().notNullable().references(`${entityType}s.id`);
|
|
table.string('filename');
|
|
table.string('originalname');
|
|
table.string('mimetype');
|
|
table.string('encoding');
|
|
table.integer('size');
|
|
table.timestamp('created').defaultTo(knex.fn.now());
|
|
table.index(['entity', 'originalname'])
|
|
})
|
|
|
|
}
|
|
})();
|
|
|
|
exports.down = (knex, Promise) => (async() => {
|
|
for (const entityType of entityTypesWithFiles) {
|
|
await knex.schema.dropTable(`files_${entityType}`);
|
|
}
|
|
})();
|