-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from RoutinelyOrganization/develop
Sync
- Loading branch information
Showing
13 changed files
with
128 additions
and
208 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
prisma/migrations/20230620193039_sessions_model/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
prisma/migrations/20230701205249_account_permissions/migration.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
prisma/migrations/20230703104927_remember_session/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
128 changes: 128 additions & 0 deletions
128
prisma/migrations/20231110061420_initial_setup/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
-- CreateEnum | ||
CREATE TYPE "GoalPeriodicity" AS ENUM ('daily', 'weekly', 'biweekly', 'monthly', 'bimonthly'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "GoalType" AS ENUM ('personal', 'profissional'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "TaskPriorities" AS ENUM ('low', 'medium', 'high', 'urgent'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "TaskTags" AS ENUM ('personal', 'study', 'finance', 'career', 'health'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "accounts" ( | ||
"id" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"permissions" TEXT[], | ||
"verified_at" TIMESTAMP(3), | ||
"accepted_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "accounts_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "ResetPasswordToken" ( | ||
"id" SERIAL NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"account_id" TEXT NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "ResetPasswordToken_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "profiles" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
"account_id" TEXT NOT NULL, | ||
|
||
CONSTRAINT "profiles_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "sessions" ( | ||
"id" SERIAL NOT NULL, | ||
"session_token" TEXT NOT NULL, | ||
"refresh_token" TEXT NOT NULL, | ||
"account_id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"permissions" TEXT[], | ||
"remember" BOOLEAN NOT NULL DEFAULT false, | ||
"session_expires_in" TIMESTAMP(3) NOT NULL, | ||
"refresh_expires_in" TIMESTAMP(3) NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "sessions_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "tasks" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"hour" TIME NOT NULL, | ||
"date" DATE NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"priority" "TaskPriorities" NOT NULL, | ||
"tag" "TaskTags" NOT NULL, | ||
"account_id" TEXT NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "tasks_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "goals" ( | ||
"id" SERIAL NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"goal" TEXT NOT NULL, | ||
"start_date" DATE NOT NULL, | ||
"end_date" DATE NOT NULL, | ||
"periodicity" "GoalPeriodicity" NOT NULL, | ||
"type" "GoalType" NOT NULL, | ||
"account_id" TEXT NOT NULL, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "goals_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "accounts_email_key" ON "accounts"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ResetPasswordToken_token_key" ON "ResetPasswordToken"("token"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ResetPasswordToken_account_id_key" ON "ResetPasswordToken"("account_id"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "profiles_account_id_key" ON "profiles"("account_id"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "sessions_session_token_key" ON "sessions"("session_token"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "sessions_refresh_token_key" ON "sessions"("refresh_token"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ResetPasswordToken" ADD CONSTRAINT "ResetPasswordToken_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "profiles" ADD CONSTRAINT "profiles_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "tasks" ADD CONSTRAINT "tasks_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "goals" ADD CONSTRAINT "goals_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |