CLI
Database management commands.
Manage your analytics database.
Commands
migrate
Create database tables:
export DATABASE_URL="./analytics.db"
npx locallytics migratereset
Warning
Deletes all data permanently.
Drop and recreate tables:
npx locallytics resetgenerate
Inject Locallytics models into your Prisma schema:
npx locallytics generateUse this if you're using Prisma ORM. It adds Pageview and Event models to your schema.prisma file.
After running generate, remember to:
- Run
npx prisma generate - Run
npx prisma db pushornpx prisma migrate dev
help
Show auto-generated help for all commands:
npx locallytics helpDatabase URLs
PostgreSQL:
DATABASE_URL="postgres://user:pass@localhost:5432/db"SQLite:
DATABASE_URL="./analytics.db"