ALTER TABLE "entity_documents"
  ADD COLUMN IF NOT EXISTS "document_role" VARCHAR(50) NOT NULL DEFAULT 'attachment',
  ADD COLUMN IF NOT EXISTS "sort_order" INTEGER NOT NULL DEFAULT 0;

CREATE INDEX IF NOT EXISTS "entity_documents_property_id_document_role_idx"
  ON "entity_documents"("property_id", "document_role");

ALTER TABLE "properties"
  ADD COLUMN IF NOT EXISTS "construction" VARCHAR(100),
  ADD COLUMN IF NOT EXISTS "condition" VARCHAR(100),
  ADD COLUMN IF NOT EXISTS "year_built" INTEGER,
  ADD COLUMN IF NOT EXISTS "heating" VARCHAR(100);
