Templates/Operations & logistics
Parking database schema
Car parks with spaces, permits for vehicles and paid parking sessions.
5 tables, 6 relationships
Opens as a new diagram you can change. Free.
Tables
car_parks
- iduuid not null
- nametext not null
- addresstext not null
- hourly_ratenumeric(6,2) not null
- created_attimestamptz not null
spaces
- iduuid not null
- car_park_id> car_parksuuid not null
- codetext not null
- accessibleboolean not null
- created_attimestamptz not null
vehicles
- iduuid not null
- registrationtext not null
- owner_emailtext
- created_attimestamptz not null
permits
- iduuid not null
- vehicle_id> vehiclesuuid not null
- car_park_id> car_parksuuid not null
- valid_fromdate not null
- valid_todate not null
- created_attimestamptz not null
parking_sessions
- iduuid not null
- vehicle_id> vehiclesuuid not null
- car_park_id> car_parksuuid not null
- space_id> spacesuuid
- entered_attimestamptz not null
- exited_attimestamptz
- amountnumeric(8,2)
- 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 "car_parks" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"name" TEXT NOT NULL,
"address" TEXT NOT NULL,
"hourly_rate" NUMERIC(6,2) NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "parking_sessions" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"vehicle_id" UUID NOT NULL,
"car_park_id" UUID NOT NULL,
"space_id" UUID,
"entered_at" TIMESTAMPTZ NOT NULL,
"exited_at" TIMESTAMPTZ,
"amount" NUMERIC(8,2),
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "permits" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"vehicle_id" UUID NOT NULL,
"car_park_id" UUID NOT NULL,
"valid_from" DATE NOT NULL,
"valid_to" DATE NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "spaces" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"car_park_id" UUID NOT NULL,
"code" TEXT NOT NULL,
"accessible" BOOLEAN DEFAULT false NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "vehicles" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"registration" TEXT NOT NULL UNIQUE,
"owner_email" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "spaces" ADD CONSTRAINT "fk_spaces_car_park_id" FOREIGN KEY ("car_park_id") REFERENCES "car_parks" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "permits" ADD CONSTRAINT "fk_permits_vehicle_id" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "permits" ADD CONSTRAINT "fk_permits_car_park_id" FOREIGN KEY ("car_park_id") REFERENCES "car_parks" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "parking_sessions" ADD CONSTRAINT "fk_parking_sessions_vehicle_id" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "parking_sessions" ADD CONSTRAINT "fk_parking_sessions_car_park_id" FOREIGN KEY ("car_park_id") REFERENCES "car_parks" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "parking_sessions" ADD CONSTRAINT "fk_parking_sessions_space_id" FOREIGN KEY ("space_id") REFERENCES "spaces" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;More Operations & logistics templates
- Fleet managementVehicles and drivers, trips, maintenance records and fuel logs.
- Shipping & trackingShipments of packages between addresses, carriers and tracking events.
- ManufacturingProducts with bills of materials, work orders routed through machine operations.
- Field serviceCustomer sites, jobs dispatched to technicians, visits and parts used.
- IT asset managementHardware and licences assigned to employees, with a maintenance history.
- IoT telemetryDevices with sensors streaming readings, thresholds and alerts.
- Ride hailingRiders request trips, drivers with vehicles accept, then payments and ratings.
- Construction projectsProjects on sites, contractors, tasks, change orders and inspections.
- Farm managementFields planted with crops, harvests, equipment and livestock.
- Sensor readings (Cassandra)Time series per device and day, newest first, with the latest reading kept in a table of its own.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.