Pragmatic Database Schema Naming Conventions, Practices, and Patterns

What We’re Working With, Some of The Database Rules

Table, Column, Tuple, or Related Naming Conventions

Schema/Domain Naming Conventions

An Example

Database Schema
CREATE TABLE "Source" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"Name" text,
"Uri" text,
"Details" text
);
CREATE TABLE "SourceNotes" (
"SourceId" uuid,
"NotesId" uuid,
"Details" text,
"Stamp" timestamp
);
CREATE TABLE "NoteJot" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"NoteId" uuid,
"Details" text
);
CREATE TABLE "Action" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"Action" json
);
CREATE TABLE "Connection" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"ActionId" uuid,
"SourceId" uuid
);
CREATE TABLE "Formatter" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"ConnectionId" uuid,
"FormatterMap" json
);
CREATE TABLE "Schema" (
"Id" uuid PRIMARY KEY,
"Stamp" timestamp,
"ConnectionId" uuid,
"SchemaMap" json
);
ALTER TABLE "SourceNotes" ADD FOREIGN KEY ("SourceId") REFERENCES "Source" ("Id");ALTER TABLE "SourceNotes" ADD FOREIGN KEY ("NotesId") REFERENCES "NoteJot" ("Id");ALTER TABLE "NoteJot" ADD FOREIGN KEY ("NoteId") REFERENCES "NoteJot" ("Id");ALTER TABLE "Connection" ADD FOREIGN KEY ("ActionId") REFERENCES "Action" ("Id");ALTER TABLE "Connection" ADD FOREIGN KEY ("SourceId") REFERENCES "Source" ("Id");ALTER TABLE "Formatter" ADD FOREIGN KEY ("ConnectionId") REFERENCES "Connection" ("Id");ALTER TABLE "Schema" ADD FOREIGN KEY ("ConnectionId") REFERENCES "Connection" ("Id");

Do NOT Use These

Summary & Caveat

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store