mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 10:13:41 -05:00
major refactoring + docker progress
This commit is contained in:
parent
ecb8a80f8b
commit
e75f8c944a
35 changed files with 227 additions and 104 deletions
20
backend/migrations/20240719191810_init/migration.sql
Normal file
20
backend/migrations/20240719191810_init/migration.sql
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "Stream" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"key" TEXT NOT NULL,
|
||||
"active" BOOLEAN NOT NULL DEFAULT false,
|
||||
"focused" BOOLEAN NOT NULL DEFAULT false,
|
||||
CONSTRAINT "Stream_key_fkey" FOREIGN KEY ("key") REFERENCES "User" ("slackId") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"slackId" TEXT NOT NULL PRIMARY KEY,
|
||||
"name" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Stream_key_key" ON "Stream"("key");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_slackId_key" ON "User"("slackId");
|
||||
41
backend/migrations/20240815175119_pls_work/migration.sql
Normal file
41
backend/migrations/20240815175119_pls_work/migration.sql
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `active` on the `Stream` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `focused` on the `Stream` table. All the data in the column will be lost.
|
||||
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- You are about to drop the column `slackId` on the `User` table. All the data in the column will be lost.
|
||||
- Added the required column `user_id` to the `Stream` table without a default value. This is not possible if the table is not empty.
|
||||
- The required column `id` was added to the `User` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
||||
- Added the required column `slack_id` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Stream" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"is_live" BOOLEAN NOT NULL DEFAULT false,
|
||||
"is_focused" BOOLEAN NOT NULL DEFAULT false,
|
||||
"key" TEXT NOT NULL,
|
||||
"user_id" TEXT NOT NULL,
|
||||
CONSTRAINT "Stream_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Stream" ("id", "key") SELECT "id", "key" FROM "Stream";
|
||||
DROP TABLE "Stream";
|
||||
ALTER TABLE "new_Stream" RENAME TO "Stream";
|
||||
CREATE UNIQUE INDEX "Stream_key_key" ON "Stream"("key");
|
||||
CREATE UNIQUE INDEX "Stream_user_id_key" ON "Stream"("user_id");
|
||||
CREATE TABLE "new_User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"slack_id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL
|
||||
);
|
||||
INSERT INTO "new_User" ("name") SELECT "name" FROM "User";
|
||||
DROP TABLE "User";
|
||||
ALTER TABLE "new_User" RENAME TO "User";
|
||||
CREATE UNIQUE INDEX "User_slack_id_key" ON "User"("slack_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
10
backend/migrations/20240816163601_add_pr_model/migration.sql
Normal file
10
backend/migrations/20240816163601_add_pr_model/migration.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"userId" TEXT NOT NULL,
|
||||
"token" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "PullRequest_token_key" ON "PullRequest"("token");
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"userId" TEXT,
|
||||
"token" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("id", "token", "userId") SELECT "id", "token", "userId" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_token_key" ON "PullRequest"("token");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `github_id` to the `PullRequest` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"userId" TEXT,
|
||||
"token" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("id", "token", "userId") SELECT "id", "token", "userId" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
CREATE UNIQUE INDEX "PullRequest_token_key" ON "PullRequest"("token");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- The required column `secondary_token` was added to the `PullRequest` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"userId" TEXT,
|
||||
"token" TEXT NOT NULL,
|
||||
"secondary_token" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("github_id", "id", "token", "userId") SELECT "github_id", "id", "token", "userId" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
CREATE UNIQUE INDEX "PullRequest_token_key" ON "PullRequest"("token");
|
||||
CREATE UNIQUE INDEX "PullRequest_secondary_token_key" ON "PullRequest"("secondary_token");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `userId` on the `PullRequest` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- CreateTable
|
||||
CREATE TABLE "_PullRequestToPossibleUser" (
|
||||
"A" INTEGER NOT NULL,
|
||||
"B" TEXT NOT NULL,
|
||||
CONSTRAINT "_PullRequestToPossibleUser_A_fkey" FOREIGN KEY ("A") REFERENCES "PullRequest" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "_PullRequestToPossibleUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"known_user_id" TEXT,
|
||||
"token" TEXT NOT NULL,
|
||||
"secondary_token" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_known_user_id_fkey" FOREIGN KEY ("known_user_id") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("github_id", "id", "secondary_token", "token") SELECT "github_id", "id", "secondary_token", "token" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
CREATE UNIQUE INDEX "PullRequest_token_key" ON "PullRequest"("token");
|
||||
CREATE UNIQUE INDEX "PullRequest_secondary_token_key" ON "PullRequest"("secondary_token");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "_PullRequestToPossibleUser_AB_unique" ON "_PullRequestToPossibleUser"("A", "B");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_PullRequestToPossibleUser_B_index" ON "_PullRequestToPossibleUser"("B");
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `_PullRequestToPossibleUser` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropTable
|
||||
PRAGMA foreign_keys=off;
|
||||
DROP TABLE "_PullRequestToPossibleUser";
|
||||
PRAGMA foreign_keys=on;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `known_user_id` on the `PullRequest` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `secondary_token` on the `PullRequest` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `token` on the `PullRequest` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "github_user_id" TEXT;
|
||||
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"user_id" TEXT,
|
||||
CONSTRAINT "PullRequest_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("github_id", "id") SELECT "github_id", "id" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "github_token" TEXT;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `github_token` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "PullRequest" ADD COLUMN "gh_user_id" TEXT;
|
||||
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"slack_id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"github_user_id" TEXT
|
||||
);
|
||||
INSERT INTO "new_User" ("created_at", "github_user_id", "id", "name", "slack_id") SELECT "created_at", "github_user_id", "id", "name", "slack_id" FROM "User";
|
||||
DROP TABLE "User";
|
||||
ALTER TABLE "new_User" RENAME TO "User";
|
||||
CREATE UNIQUE INDEX "User_slack_id_key" ON "User"("slack_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `github_user_id` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"slack_id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL
|
||||
);
|
||||
INSERT INTO "new_User" ("created_at", "id", "name", "slack_id") SELECT "created_at", "id", "name", "slack_id" FROM "User";
|
||||
DROP TABLE "User";
|
||||
ALTER TABLE "new_User" RENAME TO "User";
|
||||
CREATE UNIQUE INDEX "User_slack_id_key" ON "User"("slack_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- Made the column `gh_user_id` on table `PullRequest` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"gh_user_id" TEXT NOT NULL,
|
||||
CONSTRAINT "PullRequest_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("gh_user_id", "github_id", "id", "user_id") SELECT "gh_user_id", "github_id", "id", "user_id" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `gh_user_id` on the `PullRequest` table. The data in that column could be lost. The data in that column will be cast from `String` to `Int`.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_PullRequest" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"github_id" INTEGER NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"gh_user_id" INTEGER NOT NULL,
|
||||
CONSTRAINT "PullRequest_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_PullRequest" ("gh_user_id", "github_id", "id", "user_id") SELECT "gh_user_id", "github_id", "id", "user_id" FROM "PullRequest";
|
||||
DROP TABLE "PullRequest";
|
||||
ALTER TABLE "new_PullRequest" RENAME TO "PullRequest";
|
||||
CREATE UNIQUE INDEX "PullRequest_github_id_key" ON "PullRequest"("github_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "Session" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"timestamp" TEXT NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"duration" INTEGER NOT NULL,
|
||||
"reviewed" BOOLEAN NOT NULL DEFAULT false,
|
||||
"approved" BOOLEAN NOT NULL DEFAULT false,
|
||||
CONSTRAINT "Session_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Session_user_id_key" ON "Session"("user_id");
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `user_id` on the `Session` table. All the data in the column will be lost.
|
||||
- Added the required column `pr_id` to the `Session` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Session" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"pr_id" INTEGER NOT NULL,
|
||||
"timestamp" TEXT NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"duration" INTEGER NOT NULL,
|
||||
"reviewed" BOOLEAN NOT NULL DEFAULT false,
|
||||
"approved" BOOLEAN NOT NULL DEFAULT false,
|
||||
CONSTRAINT "Session_pr_id_fkey" FOREIGN KEY ("pr_id") REFERENCES "PullRequest" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Session" ("approved", "duration", "filename", "id", "reviewed", "timestamp") SELECT "approved", "duration", "filename", "id", "reviewed", "timestamp" FROM "Session";
|
||||
DROP TABLE "Session";
|
||||
ALTER TABLE "new_Session" RENAME TO "Session";
|
||||
CREATE UNIQUE INDEX "Session_pr_id_key" ON "Session"("pr_id");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-- DropIndex
|
||||
DROP INDEX "Session_pr_id_key";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[filename]` on the table `Session` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Session_filename_key" ON "Session"("filename");
|
||||
3
backend/migrations/migration_lock.toml
Normal file
3
backend/migrations/migration_lock.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "sqlite"
|
||||
Loading…
Add table
Add a link
Reference in a new issue