diff --git a/backend/keystone.ts b/backend/keystone.ts index d2c27dd6..cf0ac005 100644 --- a/backend/keystone.ts +++ b/backend/keystone.ts @@ -4,7 +4,6 @@ import { config } from '@keystone-6/core'; import { statelessSessions } from '@keystone-6/core/session'; import Auth0 from '@opensaas/keystone-nextjs-auth/providers/auth0'; import { createAuth } from '@opensaas/keystone-nextjs-auth'; -import { KeystoneContext } from '@keystone-6/core/types'; import { lists } from './schemas'; import { permissionsList } from './schemas/permissionFields'; @@ -53,14 +52,11 @@ export default auth.withAuth( }, }, db: { - provider: 'postgresql', - url: - process.env.DATABASE_URL || - 'postgres://postgres:mysecretpassword@localhost:55000/opensaas-local', - useMigrations: true, + provider: 'sqlite', + url: process.env.DATABASE_URL || 'file:./dev.db', }, ui: { - isAccessAllowed: (context: KeystoneContext) => !!context.session, + isAccessAllowed: context => !!context.session, publicPages: ['/admin/auth/signin', '/admin/auth/error'], getAdditionalFiles: [ async () => [ diff --git a/backend/migrations/20210629111049_init_migration/migration.sql b/backend/migrations/20210629111049_init_migration/migration.sql deleted file mode 100644 index 27628ef6..00000000 --- a/backend/migrations/20210629111049_init_migration/migration.sql +++ /dev/null @@ -1,36 +0,0 @@ --- CreateTable -CREATE TABLE "Role" ( - "id" TEXT NOT NULL, - "name" TEXT, - "canManageProducts" BOOLEAN, - "canSeeOtherUsers" BOOLEAN, - "canManageUsers" BOOLEAN, - "canManageRoles" BOOLEAN, - "canManageCart" BOOLEAN, - "canManageOrgs" BOOLEAN, - - PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "User" ( - "id" TEXT NOT NULL, - "name" TEXT, - "email" TEXT, - "subjectId" TEXT, - "role" TEXT, - - PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "User.email_unique" ON "User"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "User.subjectId_unique" ON "User"("subjectId"); - --- CreateIndex -CREATE INDEX "User.role_index" ON "User"("role"); - --- AddForeignKey -ALTER TABLE "User" ADD FOREIGN KEY ("role") REFERENCES "Role"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/backend/migrations/20210908063031_keystone25_upgrade/migration.sql b/backend/migrations/20210908063031_keystone25_upgrade/migration.sql deleted file mode 100644 index 243b7253..00000000 --- a/backend/migrations/20210908063031_keystone25_upgrade/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ --- DropIndex -DROP INDEX "User.email_unique"; - --- DropIndex -DROP INDEX "User.subjectId_unique"; - --- CreateIndex -CREATE INDEX "User.email_index" ON "User"("email"); - --- CreateIndex -CREATE INDEX "User.subjectId_index" ON "User"("subjectId"); diff --git a/backend/migrations/20211005064428_keystone_26/migration.sql b/backend/migrations/20211005064428_keystone_26/migration.sql deleted file mode 100644 index 52066008..00000000 --- a/backend/migrations/20211005064428_keystone_26/migration.sql +++ /dev/null @@ -1,47 +0,0 @@ -/* - Warnings: - - - Made the column `name` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canManageProducts` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canSeeOtherUsers` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canManageUsers` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canManageRoles` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canManageCart` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `canManageOrgs` on table `Role` required. This step will fail if there are existing NULL values in that column. - - Made the column `name` on table `User` required. This step will fail if there are existing NULL values in that column. - - Made the column `email` on table `User` required. This step will fail if there are existing NULL values in that column. - - Made the column `subjectId` on table `User` required. This step will fail if there are existing NULL values in that column. - -*/ --- AlterTable -ALTER TABLE "Role" ALTER COLUMN "name" SET NOT NULL, -ALTER COLUMN "name" SET DEFAULT E'', -ALTER COLUMN "canManageProducts" SET NOT NULL, -ALTER COLUMN "canManageProducts" SET DEFAULT false, -ALTER COLUMN "canSeeOtherUsers" SET NOT NULL, -ALTER COLUMN "canSeeOtherUsers" SET DEFAULT false, -ALTER COLUMN "canManageUsers" SET NOT NULL, -ALTER COLUMN "canManageUsers" SET DEFAULT false, -ALTER COLUMN "canManageRoles" SET NOT NULL, -ALTER COLUMN "canManageRoles" SET DEFAULT false, -ALTER COLUMN "canManageCart" SET NOT NULL, -ALTER COLUMN "canManageCart" SET DEFAULT false, -ALTER COLUMN "canManageOrgs" SET NOT NULL, -ALTER COLUMN "canManageOrgs" SET DEFAULT false; - --- AlterTable -ALTER TABLE "User" ALTER COLUMN "name" SET NOT NULL, -ALTER COLUMN "name" SET DEFAULT E'', -ALTER COLUMN "email" SET NOT NULL, -ALTER COLUMN "email" SET DEFAULT E'', -ALTER COLUMN "subjectId" SET NOT NULL, -ALTER COLUMN "subjectId" SET DEFAULT E''; - --- RenameIndex -ALTER INDEX "User.email_index" RENAME TO "User_email_idx"; - --- RenameIndex -ALTER INDEX "User.role_index" RENAME TO "User_role_idx"; - --- RenameIndex -ALTER INDEX "User.subjectId_index" RENAME TO "User_subjectId_idx"; diff --git a/backend/migrations/20211101093015_subject_unique/migration.sql b/backend/migrations/20211101093015_subject_unique/migration.sql deleted file mode 100644 index 03ef994f..00000000 --- a/backend/migrations/20211101093015_subject_unique/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[subjectId]` on the table `User` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropIndex -DROP INDEX "User_subjectId_idx"; - --- CreateIndex -CREATE UNIQUE INDEX "User_subjectId_key" ON "User"("subjectId"); diff --git a/backend/migrations/migration_lock.toml b/backend/migrations/migration_lock.toml deleted file mode 100644 index fbffa92c..00000000 --- a/backend/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (i.e. Git) -provider = "postgresql" \ No newline at end of file diff --git a/backend/schema.graphql b/backend/schema.graphql index 78fe984d..32f41c78 100644 --- a/backend/schema.graphql +++ b/backend/schema.graphql @@ -55,15 +55,9 @@ input StringFilter { contains: String startsWith: String endsWith: String - mode: QueryMode not: NestedStringFilter } -enum QueryMode { - default - insensitive -} - input NestedStringFilter { equals: String in: [String!] @@ -325,6 +319,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldPosition { sidebar } +enum QueryMode { + default + insensitive +} + type KeystoneAdminUIFieldGroupMeta { label: String! description: String diff --git a/backend/schema.prisma b/backend/schema.prisma index ac33c38f..5f149d49 100644 --- a/backend/schema.prisma +++ b/backend/schema.prisma @@ -1,10 +1,10 @@ // This file is automatically generated by Keystone, do not modify it manually. // Modify your Keystone config when you want to change this. -datasource postgresql { +datasource sqlite { url = env("DATABASE_URL") shadowDatabaseUrl = env("SHADOW_DATABASE_URL") - provider = "postgresql" + provider = "sqlite" } generator client {