Without --prune, seeds continue to only upsert (add/update). With --prune, routes, encounters, and bosses not present in the seed JSON files are deleted from the database. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
783 B
Python
33 lines
783 B
Python
"""Entry point for running seeds.
|
|
|
|
Usage:
|
|
python -m app.seeds # Run seed
|
|
python -m app.seeds --prune # Run seed and remove stale data not in seed files
|
|
python -m app.seeds --verify # Run seed + verification
|
|
python -m app.seeds --export # Export all seed data from DB to JSON files
|
|
"""
|
|
|
|
import asyncio
|
|
import sys
|
|
|
|
from app.core.database import engine
|
|
from app.seeds.run import export_all, seed, verify
|
|
|
|
|
|
async def main():
|
|
verbose = "--verbose" in sys.argv or "-v" in sys.argv
|
|
engine.echo = verbose
|
|
|
|
if "--export" in sys.argv:
|
|
await export_all()
|
|
return
|
|
|
|
prune = "--prune" in sys.argv
|
|
await seed(prune=prune)
|
|
if "--verify" in sys.argv:
|
|
await verify()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|