Remove the V1 database importer
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s

The /api/import/v1 endpoint, server/services/v1import.ts and its test are
gone; Settings already restores full V2 backups in that place. MIGRATION.md
now covers V1 JSON exports and running the old importer from history
(7125dec), plus moving data between V2 installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 12:35:51 -07:00
parent 7125dec3e0
commit 5fef59b07b
6 changed files with 29 additions and 359 deletions

View file

@ -1,25 +1,27 @@
# Importing V1 safely
# Moving data into V2
V1 code remains on `main` at `7bd0a9a` and in history. V2 has a separate schema and must use
a separate data folder. It never upgrades a production V1 database in place.
V2 has its own schema and must use its own data folder. It never opens or upgrades a V1
database.
1. Use V1's backup facility to make a consistent SQLite copy. If copying files yourself,
stop V1 first; copying only a live WAL-mode `.db` can omit recent writes.
2. Keep the original and a verified backup untouched. Start V2 with an empty V2 volume.
3. Settings no longer shows the V1 import (its place went to restoring a full V2 backup), but
the endpoint remains. While signed in, preview the **backup copy** with
`POST /api/import/v1?preview=1` (multipart field `file`, header `X-Requested-With: studydesk`),
then import it without `?preview=1`.
4. Review the reported counts/skipped items, then explicitly import. V2 opens the submitted
SQLite file read-only and creates new IDs in one transaction. A failed import rolls back.
5. Compare class/folder/deck/quiz counts and representative questions, rationales, attempts and
scheduling. V1's passwords, provider settings and share URLs are not reused. Recreate links
deliberately. Running the import again creates another set of content.
## From V1
The importer supports V1 classes, material groups, decks/cards, quiz sets/questions/options,
completed attempts, spaced-repetition card state and activity where present. It reports
unsupported/skipped records. Older optional game features are not migrated as games.
V1 JSON quiz/flashcard exports can also be pasted/uploaded in a class's Import dialog.
V2 no longer imports V1 databases. The importer (`server/services/v1import.ts` and the
`/api/import/v1` endpoint) was removed on 2026-11-16, and Settings → Data now restores full V2
backups instead. Two ways remain for V1 content:
Portable V2 JSON exports are useful for migration between apps; full ZIP backups are needed
to preserve progress, documents, settings and credentials. See DEPLOYMENT.md for recovery.
- **V1 JSON exports.** V1 quiz and flashcard exports can be pasted or uploaded in a class's
Import dialog. This brings content only: no attempts, schedules or activity.
- **The old importer.** It is in git history, last as of commit `7125dec`. Check that commit out
into a separate working copy and run it against an empty V2 data folder. Point it at a
consistent **backup copy** of the V1 database, never the live file. Make a full V2 backup
afterwards, then restore that backup on the current version.
V1 code remains on `main` at `7bd0a9a` and in history.
## Between V2 installs
- **Full backup ZIP** (Settings → Data → Download backup, then Restore a full backup on the
other server): everything, including progress, documents, settings and AI credentials. See
DEPLOYMENT.md.
- **Portable JSON export**: classes, quizzes, flashcards and notes only, added alongside what
the other install already has.