Skip to content

Commit a23d24e

Browse files
docs(naming): create file
1 parent ea09cc2 commit a23d24e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

naming.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Postgres
2+
3+
- `user` is a reserved table name, use `"user"` instead
4+
- column names should be lowercase separated by underscore, e.g. `party_relationship`
5+
- if you intend to use camelcase for table name or/and columns, wrap them in double quotes. While this is uncommon, but it simplifies serializing the data back to entity model for some language (probably dynamic language) and most of the client javascript naming convention is also camelcase
6+
7+
```sql
8+
CREATE TABLE "public"."Post" (
9+
id int GENERATED ALWAYS AS IDENTITY,
10+
title text NOT NULL,
11+
"createdAt" timestamptz NOT NULL DEFAULT now(),
12+
content text,
13+
published boolean NOT NULL DEFAULT false,
14+
"authorId" int NOT NULL,
15+
FOREIGN KEY ("authorId") REFERENCES "public"."User"(id)
16+
17+
)
18+
```

0 commit comments

Comments
 (0)