Templates/Social & community

Creator memberships database schema

Creators offering paid tiers, supporters' pledges and members-only posts.

5 tables, 5 relationships

Opens as a new diagram you can change. Free.

Tables

creators

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

tiers

  • iduuid not null
  • creator_id> creatorsuuid not null
  • nametext not null
  • monthly_pricenumeric(8,2) not null
  • perkstext
  • created_attimestamptz not null

supporters

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

pledges

  • iduuid not null
  • supporter_id> supportersuuid not null
  • tier_id> tiersuuid not null
  • activeboolean not null
  • started_attimestamptz not null
  • created_attimestamptz not null

creator_posts

  • iduuid not null
  • creator_id> creatorsuuid not null
  • min_tier_id> tiersuuid
  • titletext not null
  • bodytext 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 "creator_posts" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "creator_id" UUID NOT NULL,
  "min_tier_id" UUID,
  "title" TEXT NOT NULL,
  "body" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "pledges" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "supporter_id" UUID NOT NULL,
  "tier_id" UUID NOT NULL,
  "active" BOOLEAN DEFAULT true NOT NULL,
  "started_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

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

CREATE TABLE "tiers" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "creator_id" UUID NOT NULL,
  "name" TEXT NOT NULL,
  "monthly_price" NUMERIC(8,2) NOT NULL,
  "perks" TEXT,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "tiers" ADD CONSTRAINT "fk_tiers_creator_id" FOREIGN KEY ("creator_id") REFERENCES "creators" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "pledges" ADD CONSTRAINT "fk_pledges_supporter_id" FOREIGN KEY ("supporter_id") REFERENCES "supporters" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "pledges" ADD CONSTRAINT "fk_pledges_tier_id" FOREIGN KEY ("tier_id") REFERENCES "tiers" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "creator_posts" ADD CONSTRAINT "fk_creator_posts_creator_id" FOREIGN KEY ("creator_id") REFERENCES "creators" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "creator_posts" ADD CONSTRAINT "fk_creator_posts_min_tier_id" FOREIGN KEY ("min_tier_id") REFERENCES "tiers" ("id") ON DELETE SET NULL 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.