Templates/Travel, property & events

Property management database schema

Buildings and units, tenants on leases, rent payments and maintenance requests.

6 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

buildings

  • iduuid not null
  • nametext not null
  • addresstext not null
  • created_attimestamptz not null

units

  • iduuid not null
  • building_id> buildingsuuid not null
  • numbertext not null
  • bedroomsinteger not null
  • created_attimestamptz not null

tenants

  • iduuid not null
  • full_nametext not null
  • emailtext not null
  • phonetext
  • created_attimestamptz not null

leases

  • iduuid not null
  • unit_id> unitsuuid not null
  • tenant_id> tenantsuuid not null
  • starts_ondate not null
  • ends_ondate not null
  • monthly_rentnumeric(10,2) not null
  • created_attimestamptz not null

rent_payments

  • iduuid not null
  • lease_id> leasesuuid not null
  • amountnumeric(10,2) not null
  • paid_ondate not null
  • created_attimestamptz not null

maintenance_requests

  • iduuid not null
  • unit_id> unitsuuid not null
  • tenant_id> tenantsuuid
  • descriptiontext not null
  • statustext not null
  • created_attimestamptz not null

As PostgreSQL

The same diagram exports to MySQL, MariaDB, SQLite, SQL Server and Oracle, and to Prisma, Drizzle, SQLAlchemy and Convex models.

CREATE TABLE "buildings" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "name" TEXT NOT NULL,
  "address" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "leases" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "unit_id" UUID NOT NULL,
  "tenant_id" UUID NOT NULL,
  "starts_on" DATE NOT NULL,
  "ends_on" DATE NOT NULL,
  "monthly_rent" NUMERIC(10,2) NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "maintenance_requests" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "unit_id" UUID NOT NULL,
  "tenant_id" UUID,
  "description" TEXT NOT NULL,
  "status" TEXT DEFAULT 'open' NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "rent_payments" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "lease_id" UUID NOT NULL,
  "amount" NUMERIC(10,2) NOT NULL,
  "paid_on" DATE NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "tenants" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "full_name" TEXT NOT NULL,
  "email" TEXT NOT NULL UNIQUE,
  "phone" TEXT,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "units" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "building_id" UUID NOT NULL,
  "number" TEXT NOT NULL,
  "bedrooms" INTEGER NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "units" ADD CONSTRAINT "fk_units_building_id" FOREIGN KEY ("building_id") REFERENCES "buildings" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "leases" ADD CONSTRAINT "fk_leases_unit_id" FOREIGN KEY ("unit_id") REFERENCES "units" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "leases" ADD CONSTRAINT "fk_leases_tenant_id" FOREIGN KEY ("tenant_id") REFERENCES "tenants" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "rent_payments" ADD CONSTRAINT "fk_rent_payments_lease_id" FOREIGN KEY ("lease_id") REFERENCES "leases" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "maintenance_requests" ADD CONSTRAINT "fk_maintenance_requests_unit_id" FOREIGN KEY ("unit_id") REFERENCES "units" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "maintenance_requests" ADD CONSTRAINT "fk_maintenance_requests_tenant_id" FOREIGN KEY ("tenant_id") REFERENCES "tenants" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

More Travel, property & events templates

Start with one diagram, free

One diagram with two branches, no card needed. Upgrade when your team needs more.