From d6aaab28f7606be519935de0d21fb76c0c1a937c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Jan 2018 14:51:05 +0100 Subject: Remove :443 from video urls too --- server/initializers/migrations/0165-video-route.ts | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server/initializers/migrations/0165-video-route.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0165-video-route.ts b/server/initializers/migrations/0165-video-route.ts new file mode 100644 index 000000000..56d98bc69 --- /dev/null +++ b/server/initializers/migrations/0165-video-route.ts @@ -0,0 +1,25 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + { + const toReplace = ':443' + const by = '' + const replacer = column => `replace("${column}", '${toReplace}', '${by}')` + + const query = `UPDATE video SET url = ${replacer('url')}` + await utils.sequelize.query(query) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3