Load the test schema once and truncate data between files.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3c0213ae74
commit
79e4fd0d4b
8 files changed
+78
-25
No files matched your search
@@ -36,6 +36,13 @@ SQLITE_HISTORY_MIGRATIONS = (
|
||||
"021_voice_legacy_immutable",
|
||||
)
|
||||
_LEADING_DIGITS = re.compile(r"^(\d{3})_.*\.sql$")
|
||||
_schema_ready = False
|
||||
|
||||
|
||||
def mark_schema_dirty() -> None:
|
||||
"""Call after DROP SCHEMA so the next init_db reloads schema.sql."""
|
||||
global _schema_ready
|
||||
_schema_ready = False
|
||||
|
||||
|
||||
def _connect_raw():
|
||||
@@ -137,13 +144,17 @@ def apply_schema_and_migrations() -> None:
|
||||
|
||||
|
||||
def ensure_postgres_ready() -> None:
|
||||
global _schema_ready
|
||||
if not use_postgres():
|
||||
return
|
||||
if _schema_ready:
|
||||
return
|
||||
wait_for_postgres()
|
||||
try:
|
||||
apply_schema_and_migrations()
|
||||
except Exception:
|
||||
sys.exit(1)
|
||||
_schema_ready = True
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
Reference in new issue
Block a user