Templates/Finance

Crowdfunding database schema

Campaigns with reward tiers, backers' pledges and creator updates.

6 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

creators

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

campaigns

  • iduuid not null
  • creator_id> creatorsuuid not null
  • titletext not null
  • goalnumeric(12,2) not null
  • ends_attimestamptz not null
  • created_attimestamptz not null

rewards

  • iduuid not null
  • campaign_id> campaignsuuid not null
  • titletext not null
  • min_pledgenumeric(10,2) not null
  • quantityinteger
  • created_attimestamptz not null

backers

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

pledges

  • iduuid not null
  • campaign_id> campaignsuuid not null
  • backer_id> backersuuid not null
  • reward_id> rewardsuuid
  • amountnumeric(10,2) not null
  • created_attimestamptz not null

campaign_updates

  • iduuid not null
  • campaign_id> campaignsuuid not null
  • 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 "backers" (
  "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 "campaign_updates" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "campaign_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "body" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "campaigns" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "creator_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "goal" NUMERIC(12,2) NOT NULL,
  "ends_at" TIMESTAMPTZ 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,
  "email" 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,
  "campaign_id" UUID NOT NULL,
  "backer_id" UUID NOT NULL,
  "reward_id" UUID,
  "amount" NUMERIC(10,2) NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "rewards" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "campaign_id" UUID NOT NULL,
  "title" TEXT NOT NULL,
  "min_pledge" NUMERIC(10,2) NOT NULL,
  "quantity" INTEGER,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "campaigns" ADD CONSTRAINT "fk_campaigns_creator_id" FOREIGN KEY ("creator_id") REFERENCES "creators" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "rewards" ADD CONSTRAINT "fk_rewards_campaign_id" FOREIGN KEY ("campaign_id") REFERENCES "campaigns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "pledges" ADD CONSTRAINT "fk_pledges_campaign_id" FOREIGN KEY ("campaign_id") REFERENCES "campaigns" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "pledges" ADD CONSTRAINT "fk_pledges_backer_id" FOREIGN KEY ("backer_id") REFERENCES "backers" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "pledges" ADD CONSTRAINT "fk_pledges_reward_id" FOREIGN KEY ("reward_id") REFERENCES "rewards" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;

ALTER TABLE "campaign_updates" ADD CONSTRAINT "fk_campaign_updates_campaign_id" FOREIGN KEY ("campaign_id") REFERENCES "campaigns" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

More Finance templates

Start with one diagram, free

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