0

I am trying to rename a column in my database.

I did

heroku pg:psql

ALTER TABLE discounts_discount RENAME COLUMN percentagediscountm TO percentagediscount

And that had no impact. I looked on a few sites and to the best of my knowledge, what I wrote above should work.

enter image description here

I tried making the change using make migrations and migrate but then got this error.

django.core.exceptions.FieldDoesNotExist: discounts.discount has no field named 'percentagediscountm'

enter image description here

I am really trying to avoid having to drop my database or rolling back Heroku to an earlier build.

Ross Symonds
  • 690
  • 1
  • 8
  • 29

1 Answers1

2

You can enter the same command with ; at the end. That should work:

ALTER TABLE discounts_discount RENAME COLUMN percentagediscountm TO percentagediscount;

You can see Here to get the detail knowledge on how it was not working.

Biplove Lamichhane
  • 3,995
  • 4
  • 14
  • 30