Overview
This spike (milestone M0) tests the risky parts of the archive design before other work starts. The spike code is temporary. The result is a set of findings, and changes to the design spec if a finding disagrees with it.
Background & Motivation
The disk export writes an archive: a SQLite file that Django manages as a second database. Morango has never used a second database at runtime. Several parts of the design depend on Django and django-mptt behavior that nobody tested in this codebase.
If one of these assumptions is wrong, later tasks build on a bad base. A short spike finds these problems early and at low cost.
Design: spec. Plan: implementation plan, Task 1.
Description & Expected Outcomes
The spike answers these questions:
- Can Django 3.2 add a database alias at runtime, with full default settings?
- Can
MigrationExecutor create all morango tables in that alias, without the contenttypes app?
- Does django-mptt send queries to the default database when a certificate is saved with
save(using=alias)?
- Can
bulk_create with explicit tree fields write a certificate chain that parent walks can read?
- Does
PRAGMA auto_vacuum=INCREMENTAL, set before migration, let PRAGMA incremental_vacuum shrink the file?
- Can the alias be removed again, so that no trace stays in
connections.databases?
The spike runs on a SQLite host and on a PostgreSQL host.
Deliverables & Contracts
The spike delivers:
- Written findings for each question.
- Updates to spec §3.3 or §3.5 when a finding disagrees with the spec.
- No code that stays in the repository.
Acceptance Criteria
Technical Pointers & Architecture
- Target Components: Django
connections handling, django.db.migrations.executor.MigrationExecutor, morango/models/certificates.py (Certificate, an MPTT model).
- Related Patterns:
morango/deferrable_foreign_keys.py already works with schema_editor.connection in a migration.
- Data Model & Schema Considerations: The morango migrations declare no dependencies on other apps (
0001_squashed_0024…).
- Resilience & Failure Modes: The spike records whether a restrictive router or a missing default setting causes a clear error.
Notes & Tradeoffs
Metadata
- Complexity: Medium
- Target Branch: release-v0.9.x
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.
Overview
This spike (milestone M0) tests the risky parts of the archive design before other work starts. The spike code is temporary. The result is a set of findings, and changes to the design spec if a finding disagrees with it.
Background & Motivation
The disk export writes an archive: a SQLite file that Django manages as a second database. Morango has never used a second database at runtime. Several parts of the design depend on Django and django-mptt behavior that nobody tested in this codebase.
If one of these assumptions is wrong, later tasks build on a bad base. A short spike finds these problems early and at low cost.
Design: spec. Plan: implementation plan, Task 1.
Description & Expected Outcomes
The spike answers these questions:
MigrationExecutorcreate all morango tables in that alias, without thecontenttypesapp?save(using=alias)?bulk_createwith explicit tree fields write a certificate chain that parent walks can read?PRAGMA auto_vacuum=INCREMENTAL, set before migration, letPRAGMA incremental_vacuumshrink the file?connections.databases?The spike runs on a SQLite host and on a PostgreSQL host.
Deliverables & Contracts
The spike delivers:
Acceptance Criteria
tests/testapp/tests/spike/directory does not exist at the end of the task.Technical Pointers & Architecture
connectionshandling,django.db.migrations.executor.MigrationExecutor,morango/models/certificates.py(Certificate, an MPTT model).morango/deferrable_foreign_keys.pyalready works withschema_editor.connectionin a migration.0001_squashed_0024…).Notes & Tradeoffs
tox -e postgres.sqlite3schema. If this spike fails, that decision needs review.Metadata
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the
release-v0.9.xcodebase.