Skip to content

Commit

Permalink
chore: subindo arquivos faltantes
Browse files Browse the repository at this point in the history
  • Loading branch information
heyitsmepablo committed Aug 13, 2024
1 parent 2f101d3 commit ce7255f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
docker/postgres/data
docker/pgadmin/
# Logs
logs
*.log
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
npm install

npm run prepare

mkdir ./docker/pgadmin

sudo chown -R 5050:5050 ./docker/pgadmin

docker compose up

```
28 changes: 28 additions & 0 deletions docker/postgres/projeto-final-ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CREATE TABLE "follows" (
"following_user_id" integer NOT NULL,
"followed_user_id" integer NOT NULL,
"created_at" timestamp
);

CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"username" varchar NOT NULL,
"password" varchar NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'NOW()'
);

CREATE TABLE "posts" (
"id" integer PRIMARY KEY NOT NULL,
"title" varchar NOT NULL,
"body" text NOT NULL,
"user_id" integer NOT NULL,
"created_at" timestamp DEFAULT 'NOW()'
);

COMMENT ON COLUMN "posts"."body" IS 'Content of the post';

ALTER TABLE "posts" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");

ALTER TABLE "follows" ADD FOREIGN KEY ("following_user_id") REFERENCES "users" ("id");

ALTER TABLE "follows" ADD FOREIGN KEY ("followed_user_id") REFERENCES "users" ("id");
7 changes: 7 additions & 0 deletions src/routes/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Router } from "express";

const router = Router()



export default router

0 comments on commit ce7255f

Please sign in to comment.