Files
heygo/scripts/README.md
T

37 lines
1.0 KiB
Markdown

# Django Links Export Tool
Standalone Python script to export shortlinks from the old Linux/Django
`links` app SQLite database into JSONL format suitable for import into
the Cloudflare D1 shortlinks system.
## Usage
```bash
# Export from a Django SQLite DB to stdout
python3 scripts/export-django-links.py --db /path/to/db.sqlite3
# Export to file
python3 scripts/export-django-links.py --db /path/to/db.sqlite3 --output ./export.jsonl
# Use env var instead of --db
export DJANGO_DB_PATH=/path/to/db.sqlite3
python3 scripts/export-django-links.py --output ./export.jsonl
# Filter by owner email (only when links_link has an owner FK column)
python3 scripts/export-django-links.py --db /path/to/db.sqlite3 --owner-email admin@example.com
```
## Output format
Line-delimited JSON (JSONL). Each line:
```json
{"alias":"claude","link_type":"redirect","target_url":"https://claude.ai","content_markdown":"","description":"","tags":["ai","tools"],"created_at":"...","updated_at":"..."}
```
## Running tests
```bash
python3 scripts/export-django-links.test.py
```