From f3706b30646c4745ecac8ee3709aebdf83b1669e Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 27 May 2023 19:24:24 +0100 Subject: [PATCH] format --- LICENSE.md | 17 +- README.md | 4 +- app/routes/admin+/cache.tsx | 4 +- docs/decisions/002-email-service.md | 4 +- .../20230525081631_init/migration.sql | 180 +++++++++--------- 5 files changed, 115 insertions(+), 94 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 1e7c64747..7c76ba3a5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,18 @@ Copyright © 2023 Kent C. Dodds -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index dd5b74bcc..1eecd5fef 100644 --- a/README.md +++ b/README.md @@ -200,8 +200,8 @@ Prior to your first deployment, you'll need to do a few things: - Create a persistent volume for the sqlite database for both your staging and production environments. Run the following (feel free to change the GB size based on your needs and the region of your choice - (`https://fly.io/docs/reference/regions/`). If you do change the region, - make sure you change the `primary_region` in fly.toml as well): + (`https://fly.io/docs/reference/regions/`). If you do change the region, make + sure you change the `primary_region` in fly.toml as well): ```sh fly volumes create data --region sjc --size 1 --app epic-stack-template diff --git a/app/routes/admin+/cache.tsx b/app/routes/admin+/cache.tsx index ac031d432..17b9de195 100644 --- a/app/routes/admin+/cache.tsx +++ b/app/routes/admin+/cache.tsx @@ -99,7 +99,7 @@ export default function CacheAdminRoute() {
@@ -112,7 +112,7 @@ export default function CacheAdminRoute() { defaultValue: query, }} /> -
+
{data.cacheKeys.sqlite.length + data.cacheKeys.lru.length} diff --git a/docs/decisions/002-email-service.md b/docs/decisions/002-email-service.md index 30f3e9aed..1b5db5b1f 100644 --- a/docs/decisions/002-email-service.md +++ b/docs/decisions/002-email-service.md @@ -22,8 +22,8 @@ discourage services and encourage quick setup. ## Decision -We will use a service for sending email. If emails don't get delivered then -it defeats the whole purpose of sending email. +We will use a service for sending email. If emails don't get delivered then it +defeats the whole purpose of sending email. We selected [Mailgun](https://www.mailgun.com/) because it has a generous free tier and has proven itself in production. However, to help with quick setup, we diff --git a/prisma/migrations/20230525081631_init/migration.sql b/prisma/migrations/20230525081631_init/migration.sql index 773721ec4..aaffc891d 100644 --- a/prisma/migrations/20230525081631_init/migration.sql +++ b/prisma/migrations/20230525081631_init/migration.sql @@ -1,136 +1,146 @@ -- CreateTable -CREATE TABLE "File" ( - "id" TEXT NOT NULL PRIMARY KEY, - "blob" BLOB NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL -); +CREATE TABLE + "File" ( + "id" TEXT NOT NULL PRIMARY KEY, + "blob" BLOB NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL + ); -- CreateTable -CREATE TABLE "Image" ( - "fileId" TEXT NOT NULL, - "contentType" TEXT NOT NULL, - "altText" TEXT, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL, - CONSTRAINT "Image_fileId_fkey" FOREIGN KEY ("fileId") REFERENCES "File" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "Image" ( + "fileId" TEXT NOT NULL, + "contentType" TEXT NOT NULL, + "altText" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + CONSTRAINT "Image_fileId_fkey" FOREIGN KEY ("fileId") REFERENCES "File" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "Role" ( - "id" TEXT NOT NULL PRIMARY KEY, - "name" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL -); +CREATE TABLE + "Role" ( + "id" TEXT NOT NULL PRIMARY KEY, + "name" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL + ); -- CreateTable -CREATE TABLE "Permission" ( - "id" TEXT NOT NULL PRIMARY KEY, - "name" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL -); +CREATE TABLE + "Permission" ( + "id" TEXT NOT NULL PRIMARY KEY, + "name" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL + ); -- CreateTable -CREATE TABLE "User" ( - "id" TEXT NOT NULL PRIMARY KEY, - "email" TEXT NOT NULL, - "username" TEXT NOT NULL, - "name" TEXT, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL, - "imageId" TEXT, - CONSTRAINT "User_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "Image" ("fileId") ON DELETE SET NULL ON UPDATE CASCADE -); +CREATE TABLE + "User" ( + "id" TEXT NOT NULL PRIMARY KEY, + "email" TEXT NOT NULL, + "username" TEXT NOT NULL, + "name" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + "imageId" TEXT, + CONSTRAINT "User_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "Image" ("fileId") ON DELETE SET NULL ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "Password" ( - "hash" TEXT NOT NULL, - "userId" TEXT NOT NULL, - CONSTRAINT "Password_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "Password" ( + "hash" TEXT NOT NULL, + "userId" TEXT NOT NULL, + CONSTRAINT "Password_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "Session" ( - "id" TEXT NOT NULL PRIMARY KEY, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "userId" TEXT NOT NULL, - "expirationDate" DATETIME NOT NULL, - CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "Session" ( + "id" TEXT NOT NULL PRIMARY KEY, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "userId" TEXT NOT NULL, + "expirationDate" DATETIME NOT NULL, + CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "Note" ( - "id" TEXT NOT NULL PRIMARY KEY, - "title" TEXT NOT NULL, - "content" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL, - "ownerId" TEXT NOT NULL, - CONSTRAINT "Note_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "Note" ( + "id" TEXT NOT NULL PRIMARY KEY, + "title" TEXT NOT NULL, + "content" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL, + "ownerId" TEXT NOT NULL, + CONSTRAINT "Note_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "_RoleToUser" ( - "A" TEXT NOT NULL, - "B" TEXT NOT NULL, - CONSTRAINT "_RoleToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Role" ("id") ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT "_RoleToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "_RoleToUser" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + CONSTRAINT "_RoleToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Role" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "_RoleToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateTable -CREATE TABLE "_PermissionToRole" ( - "A" TEXT NOT NULL, - "B" TEXT NOT NULL, - CONSTRAINT "_PermissionToRole_A_fkey" FOREIGN KEY ("A") REFERENCES "Permission" ("id") ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT "_PermissionToRole_B_fkey" FOREIGN KEY ("B") REFERENCES "Role" ("id") ON DELETE CASCADE ON UPDATE CASCADE -); +CREATE TABLE + "_PermissionToRole" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL, + CONSTRAINT "_PermissionToRole_A_fkey" FOREIGN KEY ("A") REFERENCES "Permission" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "_PermissionToRole_B_fkey" FOREIGN KEY ("B") REFERENCES "Role" ("id") ON DELETE CASCADE ON UPDATE CASCADE + ); -- CreateIndex -CREATE UNIQUE INDEX "File_id_key" ON "File"("id"); +CREATE UNIQUE INDEX "File_id_key" ON "File" ("id"); -- CreateIndex -CREATE UNIQUE INDEX "Image_fileId_key" ON "Image"("fileId"); +CREATE UNIQUE INDEX "Image_fileId_key" ON "Image" ("fileId"); -- CreateIndex -CREATE UNIQUE INDEX "Role_id_key" ON "Role"("id"); +CREATE UNIQUE INDEX "Role_id_key" ON "Role" ("id"); -- CreateIndex -CREATE UNIQUE INDEX "Role_name_key" ON "Role"("name"); +CREATE UNIQUE INDEX "Role_name_key" ON "Role" ("name"); -- CreateIndex -CREATE UNIQUE INDEX "Permission_id_key" ON "Permission"("id"); +CREATE UNIQUE INDEX "Permission_id_key" ON "Permission" ("id"); -- CreateIndex -CREATE UNIQUE INDEX "Permission_name_key" ON "Permission"("name"); +CREATE UNIQUE INDEX "Permission_name_key" ON "Permission" ("name"); -- CreateIndex -CREATE UNIQUE INDEX "User_id_key" ON "User"("id"); +CREATE UNIQUE INDEX "User_id_key" ON "User" ("id"); -- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); +CREATE UNIQUE INDEX "User_email_key" ON "User" ("email"); -- CreateIndex -CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); +CREATE UNIQUE INDEX "User_username_key" ON "User" ("username"); -- CreateIndex -CREATE UNIQUE INDEX "User_imageId_key" ON "User"("imageId"); +CREATE UNIQUE INDEX "User_imageId_key" ON "User" ("imageId"); -- CreateIndex -CREATE UNIQUE INDEX "Password_userId_key" ON "Password"("userId"); +CREATE UNIQUE INDEX "Password_userId_key" ON "Password" ("userId"); -- CreateIndex -CREATE UNIQUE INDEX "Note_id_key" ON "Note"("id"); +CREATE UNIQUE INDEX "Note_id_key" ON "Note" ("id"); -- CreateIndex -CREATE UNIQUE INDEX "_RoleToUser_AB_unique" ON "_RoleToUser"("A", "B"); +CREATE UNIQUE INDEX "_RoleToUser_AB_unique" ON "_RoleToUser" ("A", "B"); -- CreateIndex -CREATE INDEX "_RoleToUser_B_index" ON "_RoleToUser"("B"); +CREATE INDEX "_RoleToUser_B_index" ON "_RoleToUser" ("B"); -- CreateIndex -CREATE UNIQUE INDEX "_PermissionToRole_AB_unique" ON "_PermissionToRole"("A", "B"); +CREATE UNIQUE INDEX "_PermissionToRole_AB_unique" ON "_PermissionToRole" ("A", "B"); -- CreateIndex -CREATE INDEX "_PermissionToRole_B_index" ON "_PermissionToRole"("B"); +CREATE INDEX "_PermissionToRole_B_index" ON "_PermissionToRole" ("B");