[Fixed]-Setting up dj-stripe (initial migrations) ProgrammingError: relation "djstripe_customer" does not exist

1👍

@kavanaugh-development solved this:

To completely remove remnant of the initial install, I had to remove the relevant djstripe rows from the migrations table. “If you don’t delete those rows, django will ignore the migration commands the second time around.”

DELETE FROM django_migrations WHERE app = 'djstripe';

Once I had done this, a fresh install of dj-stripe worked perfectly as it did the first time round:

I ran python manage.py migrate, which

  • re-created a few djstripe rows in django_migrations table
  • also created (empty) tables required for dj-stripe:

     djstripe_charge
     djstripe_charge_id_seq
     djstripe_currentsubscription
     djstripe_currentsubscription_id_seq
     djstripe_customer
     djstripe_customer_id_seq
     djstripe_event
     djstripe_event_id_seq
     djstripe_eventprocessingexception
     djstripe_eventprocessingexception_id_seq
     djstripe_invoice
     djstripe_invoice_id_seq
     djstripe_invoiceitem
     djstripe_invoiceitem_id_seq
     djstripe_plan
     djstripe_plan_id_seq
     djstripe_transfer
     djstripe_transfer_id_seq
     djstripe_transferchargefee
     djstripe_transferchargefee_id_seq
    

So the required tables are ready to be populated by the subsequent commands

(such as python manage.py djstripe_init_customers)

So that’s a general (basic) lesson learned about migrations; hope this helps someone.

Thanks

👤Mark

Leave a comment