Problems after removing references

Problems after removing references

when publishing to the onlinedev server, I had to remove the references to the oml BinaryFiles. Because of this, I had to create two new entitys, equal to those I used with BinaryFiles. But now that I removed the references, I have an error: "Database upgrade error - Field 'osusr_n7n_PICTURE_.PISCTUREID' exists in Database as Auto number. Autonumber attributes can not be changed" . What can I do?
In adtion, when published in localhost, it has no erros.
I deleted the solution form the server, and published it again, and works fine now.

Whenever you change a key or autonumber field, it will always give this error because the database constraints are already done and OutSystems does not change them back.

What you must do is go to MS-SQL directly and, if possible, delete the table.
But, if there's data that you want to keep, the alternative is to delete the constraint in MS-SQL*.

After that you can publish the Outsystems project. It will create the table structure again, with the correct constraints.

*But this is not good and doesn't work always - depending on what changes you made. Better approach is to rename the table, let Outsystems create the new one and then import the existing data to the fresh and new table.