Clean database start (only project states)

After running migrations, the only data in the database is the project lifecycle states (seven rows in project_states: planning, request_funding, waiting_for_launch, running, closed, terminated, not_funded). All other lookup data (orgs, role types, country holidays, etc.) is added via the UI or scripts.

To get a database in that “clean” state you can either use a new database or reset an existing one.

Option A: Use a new database

  1. Create a new empty database in your PostgreSQL instance (e.g. same server, different name).
  2. Set DATABASE_URL to point to that database (e.g. postgresql://rediflow:rediflow@localhost:5432/rediflow_clean).
  3. Run migrations:
    uv run python main.py migrate
    
  4. You now have a clean database: schema + project states only.

Option B: Reset the existing database

This destroys all data in the current database.

  1. Connect to PostgreSQL with a user that can drop databases (e.g. postgres). Using the default compose database name and user:

    psql -h localhost -p 5432 -U postgres -d postgres
    

    (If your instance uses the same user as the app, you may need to connect as a superuser or the owner of the database.)

  2. Drop and recreate the database (replace rediflow with your POSTGRES_DB / database name if different):

    DROP DATABASE IF EXISTS rediflow;
    CREATE DATABASE rediflow OWNER rediflow;
    \q
    
  3. Set DATABASE_URL to that database and run migrations:

    uv run python main.py migrate
    

Result: schema + project states only.

After a clean start

  • Settings / lookups: Add orgs, role types, calendars, etc. via Settings in the UI, or bulk-load from an export:

    uv run python scripts/seed_settings_data.py --json tmp/settings_export.json
    

    See How to populate fixtures (export and re-import settings data).

  • Projects: Create projects from the UI (Projects → New project) or import from fixtures (see populate-fixtures).

  • Setup: For a full new-customer flow, see Overview and Initial data entry.