Files
cms-SiteForge/scripts/verify_pg_bootstrap.py
T
浅念 8cea7dee20 chore: baseline V8.10.0-dev.1 with v8_workflows type-mapping fix and trade-pro spec
- SiteForge Enterprise V8.10.0-dev.1 upstream source (210 tests)
- Fix: v8_workflows._mapped_input now reads both 类型/分类 columns so WXR
  imports keep post/product types instead of collapsing to page
- Docs: trade-pro theme port spec (R3) and implementation plan

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-22 16:49:25 +08:00

21 lines
1.2 KiB
Python

"""PostgreSQL bootstrap smoke: execute only in a throwaway database."""
import os
if not os.getenv('SITEFORGE_DATABASE_URL','').startswith(('postgresql://','postgres://')):
raise SystemExit('Please set SITEFORGE_DATABASE_URL to a disposable PostgreSQL database')
from app import db,enterprise,factory_api,migration_audit,reusables,release_api,jobs
from app.core import save_entry
import uuid
db.init();enterprise.setup();factory_api.setup();migration_audit.setup();reusables.setup();release_api.setup()
sid=uuid.uuid4().hex[:16]
with db.connect() as c:
c.execute('INSERT INTO sites(id,name,domain,created_at,updated_at) VALUES (?,?,?,?,?)',(sid,'PG Smoke','','2026-01-01','2026-01-01'))
c.execute('INSERT INTO entries(id,site_id,type,title,route,slug,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?)',
(uuid.uuid4().hex[:16],sid,'page','Home','/','home','2026-01-01','2026-01-01'))
assert db.one('SELECT id FROM sites WHERE id=?',(sid,))['id']==sid
job=jobs.submit(sid,{'mirror_images':False},'pg-smoke','pg-smoke-unique-0001')
assert job['state']=='queued'
assert jobs.cancel(sid,job['id'])['state']=='cancelled'
with db.connect() as c:c.execute('DELETE FROM sites WHERE id=?',(sid,))
print('PostgreSQL schema, CRUD, job submit, cancel smoke passed')