Sha256: 39b0608dfbec282275ce7aeaff7a709a74f51cf1049547dfc45c4854865a28a3
Contents?: true
Size: 588 Bytes
Versions: 9
Compression:
Stored size: 588 Bytes
Contents
include ProxmoxVmUuidHelper class UpdateProxmoxUuidHost < ActiveRecord::Migration[6.0] def up execute(sql(:concat)) end def down execute(sql(:substring)) end private def concat "concat(h.compute_resource_id, '_', h.uuid) " end def substring "substring(h.uuid, position('_' in h.uuid) + 1, length(h.uuid)) " end def sql(func_type) sql = 'update hosts h set uuid = ' sql += send(func_type) sql += 'from compute_resources cr ' sql += "where cr.id = h.compute_resource_id and cr.type = 'ForemanFogProxmox::Proxmox';" sql end end
Version data entries
9 entries across 9 versions & 1 rubygems