Skip to content

chaule97/PublicLedger

Repository files navigation

Database Setup & Migration Guide

This project uses Peewee ORM and peewee-migrate to manage database schema migrations.

Ledger Screenshot

Step 2

Step 3

---

📦 Installation

  1. Create and activate a virtual environment:
python -m venv env
env\Scripts\activate         # Windows
# or
source env/bin/activate      # macOS/Linux
  1. Install dependencies:
pip install peewee peewee-migrate

🛠️ Creating the Database and Running Migrations

Step 1: Initialize database

python -m db.py

Step 2: Create a migration file

After defining your models (e.g., in models.py), generate a migration script:

python -m peewee_migrate create `MIGRATE_NAME` --database sqlite:///app.db --auto

Step 3: Apply the migration

python -m peewee_migrate migrate --database sqlite:///app.db

This applies all unapplied migrations to the database.


🔁 Other Useful Commands

Action Command
Rollback one step python -m peewee_migrate rollback
List migrations python -m peewee_migrate list

📝 Notes

  • Database file: app.db
  • Migration folder: migrations/
  • You do not need to manually create tables using db.create_tables() when using migrations.

About

State organization income and expenditure management desktop application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published