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'); + } +})()