Database Views not working on startup

Hi! We have a database view we are trying to get working. Most things run fine, but when we restart the application, the application startup always fails with the message: ALTER TABLE compose_record ALTER COLUMN id TYPE NUMERIC USING CAST(id AS NUMERIC)
server-1 | could not start Corteza: could not upgrade primary store: pq: cannot alter type of a column used by a view or rule.

So it seems the problem is it’s just trying to run migrations on views. I went into the code base, and was able to find where this particular migration is happening. I’m not a clever enough Go developer to fix this myself, but hoping one of you all could add some logic here to ignore database views?

Thanks for reporting this. We’ll investigate.

1 Like

@emmanuel don’t think we can deal with this error on Corteza end… the error states it’s modifying a table that is referenced by a view (compose_record).
I’m guessing you managed to get this working at this point?

If we wanted to deal with this on our end, we’d either have to re-do provisioning, or we’d have to analyse the entire DB schema

Alternatively, what might be the best…
Move the data from your compose_record used in your views to a dedicated table. Is that an option for you?