Skip to content

Commit

Permalink
Merge pull request #1 from La-404-Devinci/feat/database
Browse files Browse the repository at this point in the history
added db schema
  • Loading branch information
Kan-A-Pesh authored Oct 25, 2024
2 parents f2c91dd + f360093 commit 709daa2
Show file tree
Hide file tree
Showing 20 changed files with 544 additions and 167 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check lint

on:
push:
branches:
- main
- master
- develop
pull_request:
branches:
- main
- master
- develop
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
name: Check lint
steps:
- uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Check lint
run: npm run lint
4 changes: 0 additions & 4 deletions database/migrations/0000_light_tinkerer.sql

This file was deleted.

51 changes: 51 additions & 0 deletions database/migrations/0000_smart_jackal.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
CREATE TABLE IF NOT EXISTS "acquired" (
"user_uuid" uuid,
"challenge_id" serial NOT NULL,
"created_by" serial NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "acquired_user_uuid_challenge_id_pk" PRIMARY KEY("user_uuid","challenge_id")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "challenges" (
"id" serial PRIMARY KEY NOT NULL,
"club_id" serial NOT NULL,
"score" integer NOT NULL,
"name" text NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "clubs" (
"id" serial PRIMARY KEY NOT NULL,
"avatar_url" text NOT NULL,
"name" text NOT NULL,
"description" text NOT NULL,
"daily_date" date NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "granters" (
"id" serial PRIMARY KEY NOT NULL,
"club_id" serial NOT NULL,
"email" text NOT NULL,
"password" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users" (
"uuid" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"club_id" serial NOT NULL,
"email" text NOT NULL,
"hashpass" text NOT NULL,
"username" text NOT NULL,
"quote" text,
"updated_at" timestamp DEFAULT now() NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "user_uuid_idx" ON "acquired" USING btree ("user_uuid");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "challenge_id_idx" ON "acquired" USING btree ("challenge_id");--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "name_unique_idx" ON "clubs" USING btree ("name");--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "email_unique_idx" ON "users" USING btree ("email");--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "username_unique_idx" ON "users" USING btree ("username");
Loading

0 comments on commit 709daa2

Please sign in to comment.