From df69e4535a8d167f0427d1b31db207e8aa9869b4 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Sat, 11 Apr 2020 16:30:25 -0400 Subject: [PATCH] fixed migrations --- nodejs/migrations/1.js | 17 ----------------- nodejs/migrations/host_1.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 nodejs/migrations/1.js create mode 100644 nodejs/migrations/host_1.js diff --git a/nodejs/migrations/1.js b/nodejs/migrations/1.js deleted file mode 100644 index 5ad9958..0000000 --- a/nodejs/migrations/1.js +++ /dev/null @@ -1,17 +0,0 @@ -'use '; - -const client = require('../utils/redis'); - -(async function(){ - await client.rename('proxy_hosts', 'proxy_host'); - let hosts = await client.SMEMBERS('proxy_host'); - - for(let host of hosts){ - let user = await client.HGET('proxy_host_'+host, 'username'); - await client.HSET('proxy_host_'+host, 'created_by', user); - let created_on = client.HGET('proxy_host_'+host, 'updated'); - await client.HSET('proxy_host_'+host, 'created_on', created_on); - await client.HDEL('proxy_host_'+host, 'username'); - await client.HDEL('proxy_host_'+host, 'updated') - } -})() diff --git a/nodejs/migrations/host_1.js b/nodejs/migrations/host_1.js new file mode 100644 index 0000000..2f0e89c --- /dev/null +++ b/nodejs/migrations/host_1.js @@ -0,0 +1,17 @@ +'use '; + +const client = require('../utils/redis'); + +(async function(){ + await client.rename('hosts', 'host'); + let hosts = await client.SMEMBERS('host'); + + for(let host of hosts){ + let user = await client.HGET('host_'+host, 'username'); + await client.HSET('host_'+host, 'created_by', user); + let created_on = await client.HGET('host_'+host, 'updated'); + await client.HSET('host_'+host, 'created_on', created_on); + await client.HDEL('host_'+host, 'username'); + await client.HDEL('host_'+host, 'updated'); + } +})()