Fix for #663
This commit is contained in:
parent
69ce80ebfd
commit
588cf34810
1 changed files with 0 additions and 21 deletions
|
@ -1,21 +0,0 @@
|
||||||
const shortid = require('shortid');
|
|
||||||
|
|
||||||
exports.up = (knex, Promise) => (async() => {
|
|
||||||
const fields = await knex('custom_fields').whereNotNull('column');
|
|
||||||
|
|
||||||
for (const field of fields) {
|
|
||||||
const listId = field.list;
|
|
||||||
const oldName = field.column;
|
|
||||||
const newName = ('custom_' + '_' + shortid.generate()).toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
||||||
|
|
||||||
await knex('custom_fields').where('id', field.id).update('column', newName);
|
|
||||||
|
|
||||||
await knex.schema.table('subscription__' + listId, table => {
|
|
||||||
table.renameColumn(oldName, newName);
|
|
||||||
table.renameColumn('source_' + oldName, 'source_' + newName);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
exports.down = (knex, Promise) => (async() => {
|
|
||||||
})();
|
|
Loading…
Add table
Add a link
Reference in a new issue