Fix missing constraint on TENANT_ID when dropping column, add tests for view type being correctly calculated