@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
import shutil,subprocess,json,hashlib
|
||||
R=Path('C:/laragon/www/portal-investidor');O=Path(__file__).parent
|
||||
H=Path('C:/Users/macbook/.config/investmoz/classificacao-QA-20261015');Q=H/'source';BACK=H/'reversal-source'
|
||||
if BACK.exists():raise RuntimeError('Preserve existing rollback proof; inspect before replacing')
|
||||
BACK.mkdir()
|
||||
for folder in ['app','config','routes','database','resources','bootstrap']:
|
||||
shutil.copytree(R/folder,BACK/folder)
|
||||
shutil.copytree(Q/'storage',BACK/'storage')
|
||||
shutil.copytree(R/'public',BACK/'public',ignore=shutil.ignore_patterns('storage','hot'))
|
||||
subprocess.run(['powershell','-NoProfile','-Command',f"New-Item -ItemType Junction -Path '{BACK/'vendor'}' -Target '{R/'vendor'}' | Out-Null"],check=True)
|
||||
source=BACK/'app/Services/OpportunityCanonicalContract.php'
|
||||
s=source.read_text(encoding='utf8');needle="$properties['sector_id'] = ['type' => 'integer', 'minimum' => 1];";assert needle in s
|
||||
s=s.replace(needle,"// Data-preserving rollback: accept the optional field already stored; no feature or certification is activated.\n $properties['enterprise_size'] = ['type' => ['string', 'null'], 'maxLength' => 120];\n "+needle,1)
|
||||
source.write_text(s,encoding='utf8')
|
||||
package=O/'reversao-compat/app/Services/OpportunityCanonicalContract.php';package.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(source,package)
|
||||
boot=(O/'boot-QA.php').read_text(encoding='utf8').replace(str(Q).replace('\\','/'),str(BACK).replace('\\','/'))
|
||||
(O/'boot-reversal-QA.php').write_text(boot,encoding='utf8')
|
||||
print(json.dumps({'rollback_source_ready':True,'compatibility_file_sha256':hashlib.sha256(package.read_bytes()).hexdigest()}))
|
||||
Reference in New Issue
Block a user