Templates/Work & productivity

Kanban board database schema

Boards with columns of cards, members and checklists.

7 tables, 7 relationships

Opens as a new diagram you can change. Free.

Tables

users

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

boards

  • iduuid not null
  • owner_id> usersuuid not null
  • nametext not null
  • created_attimestamptz not null

board_columns

  • iduuid not null
  • board_id> boardsuuid not null
  • nametext not null
  • positioninteger not null
  • wip_limitinteger
  • created_attimestamptz not null

cards

  • iduuid not null
  • column_id> board_columnsuuid not null
  • titletext not null
  • descriptiontext
  • positioninteger not null
  • due_attimestamptz
  • created_attimestamptz not null

card_members

  • iduuid not null
  • card_id> cardsuuid not null
  • user_id> usersuuid not null
  • created_attimestamptz not null

checklists

  • iduuid not null
  • card_id> cardsuuid not null
  • titletext not null
  • created_attimestamptz not null

checklist_items

  • iduuid not null
  • checklist_id> checklistsuuid not null
  • labeltext not null
  • doneboolean 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 "board_columns" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "board_id" UUID NOT NULL,
  "name" TEXT NOT NULL,
  "position" INTEGER NOT NULL,
  "wip_limit" INTEGER,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "card_members" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "card_id" UUID NOT NULL,
  "user_id" UUID NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "cards" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "column_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "description" TEXT,
  "position" INTEGER NOT NULL,
  "due_at" TIMESTAMPTZ,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "checklist_items" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "checklist_id" UUID NOT NULL,
  "label" TEXT NOT NULL,
  "done" BOOLEAN DEFAULT false NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "checklists" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "card_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

ALTER TABLE "boards" ADD CONSTRAINT "fk_boards_owner_id" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "board_columns" ADD CONSTRAINT "fk_board_columns_board_id" FOREIGN KEY ("board_id") REFERENCES "boards" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "cards" ADD CONSTRAINT "fk_cards_column_id" FOREIGN KEY ("column_id") REFERENCES "board_columns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "card_members" ADD CONSTRAINT "fk_card_members_card_id" FOREIGN KEY ("card_id") REFERENCES "cards" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "card_members" ADD CONSTRAINT "fk_card_members_user_id" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "checklists" ADD CONSTRAINT "fk_checklists_card_id" FOREIGN KEY ("card_id") REFERENCES "cards" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "checklist_items" ADD CONSTRAINT "fk_checklist_items_checklist_id" FOREIGN KEY ("checklist_id") REFERENCES "checklists" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

More Work & productivity templates

Start with one diagram, free

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