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.

1
  • 1
    Don't do manual changes to your database structure if you want to keep the migrations in sync. Commented Sep 18, 2020 at 2:27

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.