Manage the Ghostfolio PostgreSQL database - migrations, schema, seeding, and Prisma operations
Manage the PostgreSQL database via Prisma ORM. Schema is defined at prisma/schema.prisma with 18 models and 108 migrations.
!cd /home/james-allen/Projects/ghostfolio && head -5 prisma/schema.prisma 2>/dev/null || echo "Schema not found"
Based on $ARGUMENTS:
setup (default if no argument)Full database initialization (schema push + seed):
cd /home/james-allen/Projects/ghostfolio && npm run database:setup
This runs prisma db push followed by prisma db seed.
migrateRun pending database migrations:
cd /home/james-allen/Projects/ghostfolio && npm run database:migrate
This runs prisma migrate deploy to apply all pending migrations.
seedSeed the database with initial data (creates EMERGENCY_FUND and EXCLUDE_FROM_ANALYSIS tags):
cd /home/james-allen/Projects/ghostfolio && npm run database:seed
pushPush current schema to database without creating a migration (for prototyping):
cd /home/james-allen/Projects/ghostfolio && npm run database:push
Warning: This may reset data if schema changes are destructive.
studioOpen Prisma Studio (web-based database GUI):
cd /home/james-allen/Projects/ghostfolio && npm run database:gui
Opens at http://localhost:5555.
statusCheck database connection and migration status:
cd /home/james-allen/Projects/ghostfolio && npx prisma migrate status
resetDestructive - Reset the database completely (drop all data, re-apply schema, re-seed):
cd /home/james-allen/Projects/ghostfolio && npx prisma migrate reset
Always confirm with the user before running this.
schemaRead and display the current Prisma schema, highlighting models, enums, and relationships:
prisma/schema.prismavalidateValidate the Prisma schema:
cd /home/james-allen/Projects/ghostfolio && npm run database:validate-schema
formatFormat the Prisma schema file:
cd /home/james-allen/Projects/ghostfolio && npm run database:format-schema
Database connection is configured via DATABASE_URL in .env: