fix(nexxa): cli_estado migrar se niega con el motor pg ya activo (no pisa el estado vivo con archivos viejos); 1.7.2 (P335/F17)
Tests ADN / test (push) Canceled after 0s
Tests ADN / test (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: GEMMA <noreply@gemma.dtic>
This commit is contained in:
co-authored by
Claude Opus 5.5
GEMMA
parent
43984639fa
commit
529360b98e
@@ -1 +1 @@
|
||||
1.7.1
|
||||
1.7.2
|
||||
|
||||
@@ -20,6 +20,8 @@ module Nexxa
|
||||
module CliEstado
|
||||
E = Nexxa::Estado
|
||||
USO = 'ruby cli_estado.rb esquema|migrar|verificar|exportar'
|
||||
# El drop-in que activa el motor pg en los servicios (lo escribe nexxa estado:pg --accion activar)
|
||||
DROPIN = '/etc/systemd/system/nexxa.service.d/estado.conf'
|
||||
|
||||
module_function
|
||||
|
||||
@@ -38,7 +40,19 @@ module Nexxa
|
||||
end
|
||||
end
|
||||
|
||||
def migrar(salida)
|
||||
# Con el motor pg ya activo, los archivos quedaron viejos: migrar pisaría el estado vivo con ellos. Se niega (repetir
|
||||
# 'activar' es seguro: frena acá y el trap vuelve a arrancar los servicios como estaban).
|
||||
def pg_activo?(dropin = DROPIN)
|
||||
File.exist?(dropin) && File.read(dropin).include?('NEXXA_ESTADO=pg')
|
||||
end
|
||||
|
||||
def migrar(salida, dropin: DROPIN)
|
||||
if pg_activo?(dropin)
|
||||
salida.puts("❌ el motor pg ya está activo (#{dropin}): migrar pisaría el estado vivo con archivos viejos. " \
|
||||
'Para volver a archivos: exportar (nexxa estado:pg --accion revertir)')
|
||||
return 1
|
||||
end
|
||||
|
||||
E.crear_esquema!
|
||||
dif = diferencias
|
||||
if dif.values.none?
|
||||
|
||||
Reference in New Issue
Block a user