Help me, Unknown column in ‘field list’

I have an issue that I need your help with. I added a new field to the CourseEnrollment model called “date_history,” but when I try to unenroll or enroll, I encounter the error “Unknown column ‘date_history’ in ‘field list’.” I have already added the column to the “student_courseenrollment” table, but the error persists.


Thank you all for taking a look.

Sorry, I don’t know your level of experience with Django. When you say you already added the column, do you mean you’ve updated the model. Did you verify that the column actually exists in the database? Did you create and run the migration required? See Migrations | Django documentation | Django for more details. Is this is not where your problem is, you’ll probably need to provide more details.

Hello @robrap ,
On DevStack, I ran “make dev.migrate.lms,” and it recognized my field and created the corresponding column in the database. However, when I try to unenroll course, it still gives an error message: “Unknown column ‘date_history’ in ‘field list’.”

I don’t know where the problem is, but something is out-of-sync in a way that you don’t think should be the case. Not sure if you confirmed in the actual database, or if there are multiple versions of the database and you are not looking in the place that Django is looking. See python - Unknown column '' in 'field list'. Django - Stack Overflow, although it won’t provide specific help. Sorry I can’t be of more help, but this just requires some debugging until you discover what isn’t as you expect it.