Templates/Operations & logistics

IT asset management database schema

Hardware and licences assigned to employees, with a maintenance history.

7 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

employees

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

asset_types

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

assets

  • iduuid not null
  • asset_type_id> asset_typesuuid not null
  • serial_numbertext not null
  • modeltext not null
  • purchased_ondate
  • retired_ondate
  • created_attimestamptz not null

assignments

  • iduuid not null
  • asset_id> assetsuuid not null
  • employee_id> employeesuuid not null
  • assigned_ondate not null
  • returned_ondate
  • created_attimestamptz not null

software_licences

  • iduuid not null
  • producttext not null
  • seatsinteger not null
  • expires_ondate
  • created_attimestamptz not null

licence_assignments

  • iduuid not null
  • licence_id> software_licencesuuid not null
  • employee_id> employeesuuid not null
  • created_attimestamptz not null

asset_maintenance

  • iduuid not null
  • asset_id> assetsuuid not null
  • descriptiontext not null
  • performed_ondate 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 "asset_maintenance" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "asset_id" UUID NOT NULL,
  "description" TEXT NOT NULL,
  "performed_on" DATE NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "assets" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "asset_type_id" UUID NOT NULL,
  "serial_number" TEXT NOT NULL UNIQUE,
  "model" TEXT NOT NULL,
  "purchased_on" DATE,
  "retired_on" DATE,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "assignments" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "asset_id" UUID NOT NULL,
  "employee_id" UUID NOT NULL,
  "assigned_on" DATE NOT NULL,
  "returned_on" DATE,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "licence_assignments" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "licence_id" UUID NOT NULL,
  "employee_id" UUID NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "software_licences" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "product" TEXT NOT NULL,
  "seats" INTEGER NOT NULL,
  "expires_on" DATE,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "assets" ADD CONSTRAINT "fk_assets_asset_type_id" FOREIGN KEY ("asset_type_id") REFERENCES "asset_types" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "assignments" ADD CONSTRAINT "fk_assignments_asset_id" FOREIGN KEY ("asset_id") REFERENCES "assets" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "assignments" ADD CONSTRAINT "fk_assignments_employee_id" FOREIGN KEY ("employee_id") REFERENCES "employees" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "licence_assignments" ADD CONSTRAINT "fk_licence_assignments_licence_id" FOREIGN KEY ("licence_id") REFERENCES "software_licences" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "licence_assignments" ADD CONSTRAINT "fk_licence_assignments_employee_id" FOREIGN KEY ("employee_id") REFERENCES "employees" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "asset_maintenance" ADD CONSTRAINT "fk_asset_maintenance_asset_id" FOREIGN KEY ("asset_id") REFERENCES "assets" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

More Operations & logistics templates

Start with one diagram, free

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