Make TENANT_TYPE_ID optional for tenant-specific tables and add tests to handle this case