Templates/Social & community

Meetup groups database schema

Interest groups with members, events at venues and RSVPs.

6 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

users

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

groups

  • iduuid not null
  • nametext not null
  • slugtext not null
  • descriptiontext
  • created_attimestamptz not null

group_members

  • iduuid not null
  • group_id> groupsuuid not null
  • user_id> usersuuid not null
  • roletext not null
  • created_attimestamptz not null

venues

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

meetups

  • iduuid not null
  • group_id> groupsuuid not null
  • venue_id> venuesuuid
  • titletext not null
  • starts_attimestamptz not null
  • capacityinteger
  • created_attimestamptz not null

rsvps

  • iduuid not null
  • meetup_id> meetupsuuid not null
  • user_id> usersuuid not null
  • goingboolean 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 "group_members" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "group_id" UUID NOT NULL,
  "user_id" UUID NOT NULL,
  "role" TEXT DEFAULT 'member' NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "meetups" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "group_id" UUID NOT NULL,
  "venue_id" UUID,
  "title" TEXT NOT NULL,
  "starts_at" TIMESTAMPTZ NOT NULL,
  "capacity" INTEGER,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "rsvps" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "meetup_id" UUID NOT NULL,
  "user_id" UUID NOT NULL,
  "going" BOOLEAN DEFAULT true NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "venues" (
  "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")
);

ALTER TABLE "group_members" ADD CONSTRAINT "fk_group_members_group_id" FOREIGN KEY ("group_id") REFERENCES "groups" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

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

ALTER TABLE "meetups" ADD CONSTRAINT "fk_meetups_group_id" FOREIGN KEY ("group_id") REFERENCES "groups" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "meetups" ADD CONSTRAINT "fk_meetups_venue_id" FOREIGN KEY ("venue_id") REFERENCES "venues" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;

ALTER TABLE "rsvps" ADD CONSTRAINT "fk_rsvps_meetup_id" FOREIGN KEY ("meetup_id") REFERENCES "meetups" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

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

More Social & community templates

Start with one diagram, free

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