Make persisted models use "create table as" (#22640)
* Make persisted models use "create table as" There are outstanding issues with database type erasure. If we try to recreate table columns based on the saved definition we'll get types such as `type/Structured` that could be `json`, `xml`, etc. Perhaps worse, consider 'citext' that we see as `type/Text`. If they have queries on the model such as `where email = 'JOE@example.com'` that would start to return different results if we created the table with `email text` rather than `email citext`. By using `create table ... as select ....`, we avoid this issue as the db types selected will match the db types queried. * Remove unused require * Missed validatiy check needs a query to create table as
Please register or sign in to comment