diff --git a/.gitignore b/.gitignore index 39a558c..91235c7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ # misc .DS_Store *.pem - +.cache_ggshield # debug npm-debug.log* yarn-debug.log* diff --git a/drizzle.config.ts b/drizzle.config.ts index 8b5365b..07b7c98 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -3,17 +3,29 @@ import { loadEnvConfig } from "@next/env"; loadEnvConfig(process.cwd(), true); +const base = "./src/db/"; + export default defineConfig({ schema: [ - "./src/db/asteroidz/schema.ts", - "./src/db/genshin/schema.ts", - "./src/db/todos/schema.ts", - "./src/db/tilez/schema.ts", - "./src/db/forum/schema.ts", + `${base}asteroidz/schema.ts`, + `${base}genshin/schema.ts`, + `${base}todos/schema.ts`, + `${base}tilez/schema.ts`, + `${base}forum/schema.ts`, ], - out: "./src/db/migrations", + out: `${base}migrations`, dialect: "postgresql", schemaFilter: "public", + casing: "snake_case", + migrations: { + prefix: "timestamp" + }, + entities:{ + roles: { + provider: "supabase", + exclude: ["supabase_Auth_admin"] + } + }, verbose: true, strict: true, dbCredentials: { diff --git a/package.json b/package.json index 975d95e..3b7c202 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "@mdx-js/loader": "^3.0.1", "@mdx-js/react": "^3.0.1", - "@next/mdx": "15.0.0-rc.1", + "@next/mdx": "^15.0.0", "@radix-ui/react-avatar": "^1.1.0", "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", @@ -25,16 +25,14 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-tooltip": "^1.1.2", - "@types/mdx": "^2.0.13", - "babel-plugin-react-compiler": "0.0.0-experimental-696af53-20240625", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", - "drizzle-orm": "^0.33.0", + "drizzle-orm": "^0.36.0", "jose": "^5.6.3", "lucide-react": "^0.427.0", - "next": "15.0.0-rc.1", + "next": "^15.0.0", "next-themes": "^0.3.0", - "postgres": "^3.4.4", + "postgres": "^3.4.5", "react": "19.0.0-rc-cd22717c-20241013", "react-dom": "19.0.0-rc-cd22717c-20241013", "server-only": "^0.0.1", @@ -44,16 +42,19 @@ "devDependencies": { "@faker-js/faker": "^9.0.0", "@tailwindcss/postcss": "^4.0.0-alpha.17", + "@types/mdx": "^2.0.13", "@types/node": "^20", "@types/react": "npm:types-react@19.0.0-rc.1", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", - "drizzle-kit": "^0.24.1", + "babel-plugin-react-compiler": "19.0.0-beta-8a03594-20241020", + "drizzle-kit": "^0.27.0", "eslint": "^9.12.0", - "eslint-config-next": "15.0.0-rc.1", + "eslint-config-next": "^15.0.0", + "eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020", "prettier": "^3.3.2", "prettier-plugin-tailwindcss": "^0.6.5", "tailwindcss": "^4.0.0-alpha.17", - "tsx": "^4.16.2", + "tsx": "^4.19.2", "typescript": "^5.5.3" }, "packageManager": "yarn@4.5.0", diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6b90d90..d13985c 100755 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -22,11 +22,11 @@ export default function RootLayout({ return ( - {/**/} + data-cf-beacon={`'{"token": "${process.env.NEXT_PUBLIC_ANALYTICS}"}'`} + >} {children} diff --git a/src/app/redirect/[[...redirect]]/route.ts b/src/app/redirect/[[...redirect]]/route.ts index 8727c2c..d168cbc 100755 --- a/src/app/redirect/[[...redirect]]/route.ts +++ b/src/app/redirect/[[...redirect]]/route.ts @@ -2,9 +2,12 @@ import { NextResponse } from "next/server"; import { exchangeCodeForSession } from "@/lib/auth"; // The client you created from the Server-Side Auth instructions -export async function GET(request: Request, props: { params: Promise<{ redirect?: string[] }> }) { +export async function GET( + request: Request, + props: { params: Promise<{ redirect?: string[] }> }, +) { const params = await props.params; - const { searchParams, origin } = new URL(request.url); + const { searchParams, hostname, protocol } = new URL(request.url); const code = searchParams.get("code"); const redirectUrl = `/${params.redirect?.join("/") ?? ""}`; @@ -16,14 +19,16 @@ export async function GET(request: Request, props: { params: Promise<{ redirect? const isLocalEnv = process.env.NODE_ENV === "development"; if (isLocalEnv) { // we can be sure that there is no load balancer in between, so no need to watch for X-Forwarded-Host - return NextResponse.redirect(`${origin}${redirectUrl}`); + return NextResponse.redirect(`${protocol}//${hostname}${redirectUrl}`); } else if (forwardedHost) { return NextResponse.redirect(`https://${forwardedHost}${redirectUrl}`); } else { - return NextResponse.redirect(`${origin}${redirectUrl}`); + return NextResponse.redirect(`${protocol}//${hostname}${redirectUrl}`); } } } // return the user to an error page with instructions - return NextResponse.redirect(`${origin}${redirectUrl}?error=invalid_code`); + return NextResponse.redirect( + `${protocol}//${hostname}${redirectUrl}?error=invalid_code`, + ); } diff --git a/src/app/tilez/lib/GameLogic.ts b/src/app/tilez/lib/GameLogic.ts index 7c0f85d..9396303 100644 --- a/src/app/tilez/lib/GameLogic.ts +++ b/src/app/tilez/lib/GameLogic.ts @@ -4,7 +4,7 @@ import { all_words } from "../data/all_words"; import { words } from "../data/words"; import { filter } from "../data/filter"; import { GameState, GameRow, GameTile } from "./GameTypes"; -import { getdb as db } from "@/db/tilez/db"; +import { dbClient } from "@/db/tilez/db"; import { tilez_games, tilez_words } from "@/db/tilez/schema"; import { avg, count, eq } from "drizzle-orm"; import { revalidatePath } from "next/cache"; @@ -49,14 +49,17 @@ export async function NewGame(): Promise { do { rows = words.map( (x) => - (({ + ({ position: Math.floor(Math.random() * x.length) - 1, - tiles: x.map((y) => (({ - letter: y, - found: false - }) as GameTile)) - }) as GameRow), + tiles: x.map( + (y) => + ({ + letter: y, + found: false, + }) as GameTile, + ), + }) as GameRow, ); } while ( all_words.includes(rows.map((x) => x.tiles[x.position + 1].letter).join("")) @@ -107,7 +110,7 @@ export async function uploadScore(game: GameState): Promise { if (!jwt) { return false; } - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { const newGame = await tx .insert(tilez_games) .values({ @@ -129,7 +132,7 @@ export async function uploadScore(game: GameState): Promise { async function getScore() { const jwt = await getUser(); if (!jwt) return { games: 0, average: 0 }; - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { const scores = await tx .select({ games: count(), @@ -142,8 +145,8 @@ async function getScore() { } export async function getWordDefinition(word: string): Promise { - const inDb = await db() - .select() + const inDb = await dbClient() + .db.select() .from(tilez_words) .where(eq(tilez_words.word, word)) .limit(1); @@ -167,12 +170,12 @@ export async function getWordDefinition(word: string): Promise { } catch (error) { } finally { if (inDb.length > 0) { - await db() - .update(tilez_words) + await dbClient() + .db.update(tilez_words) .set({ last_checked: new Date().toISOString(), definition: definition }) .where(eq(tilez_words.word, word)); } else { - await db().insert(tilez_words).values({ + await dbClient().db.insert(tilez_words).values({ word: word, definition: definition, last_checked: new Date().toISOString(), diff --git a/src/app/todos/actions.ts b/src/app/todos/actions.ts index a5e2371..9d40849 100644 --- a/src/app/todos/actions.ts +++ b/src/app/todos/actions.ts @@ -1,5 +1,5 @@ "use server"; -import { getdb as db } from "@/db/todos/db"; +import { dbClient } from "@/db/todos/db"; import { getUser } from "@/lib/auth-client"; import { JWTPayload } from "jose"; import { todos } from "@/db/todos/schema"; @@ -12,7 +12,7 @@ export async function addTodo(FormData: FormData) { if (!jwt) { return null; } - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { const todoList = await tx .insert(todos) .values({ title: todo, userId: jwt.sub as string }) @@ -28,8 +28,7 @@ export async function toggleTodo(id: string) { if (!jwt) { return null; } - - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { const todoList = await tx .update(todos) .set({ completed: not(todos.completed) }) @@ -45,8 +44,7 @@ export async function deleteTodo(id: string) { if (!jwt) { return null; } - - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { await tx.delete(todos).where(eq(todos.id, id)).execute(); }); @@ -58,7 +56,7 @@ export async function listTodos() { if (!jwt) { return [] as (typeof todos.$inferSelect)[]; } - const result = await db(jwt as JWTPayload).transaction(async (tx) => { + const result = await dbClient(jwt as JWTPayload).rls(async (tx) => { const todoList = await tx .select() .from(todos) diff --git a/src/components/auth.tsx b/src/components/auth.tsx index 0720cc5..d965ab9 100644 --- a/src/components/auth.tsx +++ b/src/components/auth.tsx @@ -30,9 +30,12 @@ export default async function Auth({ app }: { app: string }) { {user ? (
- + - + {getInitials((user?.user_metadata?.name as string) || "U")} diff --git a/src/db/asteroidz/schema.ts b/src/db/asteroidz/schema.ts index 3585bc7..1a3bb5f 100644 --- a/src/db/asteroidz/schema.ts +++ b/src/db/asteroidz/schema.ts @@ -116,14 +116,12 @@ export const items_required_research = pgTable( .references(() => research.id), description: text("description").notNull(), }, - (table) => { - return { - items_required_research_item_id_required_id_pk: primaryKey({ - columns: [table.item_id, table.required_id], - name: "items_required_research_item_id_required_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.item_id, table.required_id], + name: "items_required_research_item_id_required_id_pk", + }), + ], ); export const research_required_research = pgTable( @@ -137,14 +135,12 @@ export const research_required_research = pgTable( .references(() => research.id), description: text("description").notNull(), }, - (table) => { - return { - research_required_research_research_id_required_id_pk: primaryKey({ - columns: [table.research_id, table.required_id], - name: "research_required_research_research_id_required_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.research_id, table.required_id], + name: "research_required_research_research_id_required_id_pk", + }), + ], ); export const upgrade_required_research = pgTable( @@ -158,14 +154,12 @@ export const upgrade_required_research = pgTable( .references(() => research.id), description: text("description").notNull(), }, - (table) => { - return { - upgrade_required_research_upgrade_id_research_id_pk: primaryKey({ - columns: [table.upgrade_id, table.required_id], - name: "upgrade_required_research_upgrade_id_research_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.upgrade_id, table.required_id], + name: "upgrade_required_research_upgrade_id_research_id_pk", + }), + ], ); export const research_required_items = pgTable( @@ -180,14 +174,12 @@ export const research_required_items = pgTable( quantity: integer("quantity").notNull(), description: text("description").notNull(), }, - (table) => { - return { - research_required_items_research_id_item_id_pk: primaryKey({ - columns: [table.research_id, table.required_id], - name: "research_required_items_research_id_item_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.research_id, table.required_id], + name: "research_required_items_research_id_item_id_pk", + }), + ], ); export const items_required_items = pgTable( @@ -202,14 +194,12 @@ export const items_required_items = pgTable( quantity: integer("quantity").notNull(), description: text("description").notNull(), }, - (table) => { - return { - items_required_items_item_id_required_id_pk: primaryKey({ - columns: [table.item_id, table.required_id], - name: "items_required_items_item_id_required_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.item_id, table.required_id], + name: "items_required_items_item_id_required_id_pk", + }), + ], ); export const upgrade_required_items = pgTable( @@ -224,12 +214,10 @@ export const upgrade_required_items = pgTable( quantity: integer("quantity").notNull(), description: text("description").notNull(), }, - (table) => { - return { - upgrade_required_items_upgrade_id_item_id_pk: primaryKey({ - columns: [table.upgrade_id, table.required_id], - name: "upgrade_required_items_upgrade_id_item_id_pk", - }), - }; - }, + (table) => [ + primaryKey({ + columns: [table.upgrade_id, table.required_id], + name: "upgrade_required_items_upgrade_id_item_id_pk", + }), + ], ); diff --git a/src/db/auth_schema.ts b/src/db/auth_schema.ts deleted file mode 100755 index f66b19a..0000000 --- a/src/db/auth_schema.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { pgSchema, uuid } from "drizzle-orm/pg-core"; - -const mySchema = pgSchema("auth"); - -export const users = mySchema.table("users", { - id: uuid("id").primaryKey(), -}); diff --git a/src/db/db.ts b/src/db/db.ts index c1e5de1..62d44a1 100755 --- a/src/db/db.ts +++ b/src/db/db.ts @@ -10,14 +10,14 @@ import { loadEnvConfig } from "@next/env"; loadEnvConfig(process.cwd(), true); // import * as forum_relations from "./forum/relations"; -const connectionString = process.env.DATABASE_STUDIO_URL; -const client = postgres(connectionString as string, { - prepare: false, - connect_timeout: 60, - idle_timeout: 10, -}); +const connectionString = process.env.DATABASE_URL!; -export const db = drizzle(client, { +export const db = drizzle({ + client: postgres(connectionString, { + prepare: false, + connect_timeout: 60, + idle_timeout: 10, + }), schema: { ...genshin_schema, ...genshin_relations, diff --git a/src/db/forum/schema.ts b/src/db/forum/schema.ts index 182e21f..b931847 100644 --- a/src/db/forum/schema.ts +++ b/src/db/forum/schema.ts @@ -8,8 +8,8 @@ import { timestamp, uuid, } from "drizzle-orm/pg-core"; -import { users as auth } from "../auth_schema"; import { sql } from "drizzle-orm"; +import { authUsers, authenticatedRole, authUid,postgresRole } from "drizzle-orm/supabase"; export const users = pgTable( "users", @@ -18,7 +18,7 @@ export const users = pgTable( .default(sql`uuid_generate_v4()`) .primaryKey() .notNull(), - user_id: uuid("user_id").references(() => auth.id, { + user_id: uuid("user_id").references(() => authUsers.id, { onDelete: "cascade", onUpdate: "cascade", }), diff --git a/src/db/genshin/schema.ts b/src/db/genshin/schema.ts index 022a063..0910aa7 100644 --- a/src/db/genshin/schema.ts +++ b/src/db/genshin/schema.ts @@ -14,12 +14,10 @@ export const elements = pgTable( name: text("name").notNull(), colour: text("colour").notNull(), }, - (table) => { - return { - elements_name_unique: unique("elements_name_unique").on(table.name), - elements_colour_unique: unique("elements_colour_unique").on(table.colour), - }; - }, + (table) => [ + unique("elements_name_unique").on(table.name), + unique("elements_colour_unique").on(table.colour), + ], ); export const characters = pgTable( @@ -42,11 +40,11 @@ export const characters = pgTable( .notNull() .references(() => cities.id), }, - (table) => { - return { - characters_name_unique: unique("characters_name_unique").on(table.name), - }; - }, + (table) => [ + unique("characters_name_unique").on(table.name), + unique("characters_city_id_cities_id_fk").on(table.city_id), + unique("characters_element_id_elements_id_fk").on(table.element_id), + ], ); export const cities = pgTable( @@ -62,9 +60,5 @@ export const cities = pgTable( }), name: text("name").notNull(), }, - (table) => { - return { - cities_name_unique: unique("cities_name_unique").on(table.name), - }; - }, + (table) => [unique("cities_name_unique").on(table.name)], ); diff --git a/src/db/migrations/0001_slow_greymalkin.sql b/src/db/migrations/0001_slow_greymalkin.sql deleted file mode 100644 index 48fd37d..0000000 --- a/src/db/migrations/0001_slow_greymalkin.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE IF NOT EXISTS "tilez_words" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "word" char(6) NOT NULL, - "definition" text NOT NULL, - "last_checked" timestamp NOT NULL -); ---> statement-breakpoint -CREATE UNIQUE INDEX IF NOT EXISTS "tilez_word_word_idx" ON "tilez_words" USING btree ("word"); \ No newline at end of file diff --git a/src/db/migrations/0002_hesitant_lester.sql b/src/db/migrations/0002_hesitant_lester.sql deleted file mode 100644 index a6cb9ce..0000000 --- a/src/db/migrations/0002_hesitant_lester.sql +++ /dev/null @@ -1,108 +0,0 @@ -CREATE TABLE IF NOT EXISTS "hashtag_messages" ( - "hashtag_id" uuid NOT NULL, - "message_id" uuid NOT NULL, - CONSTRAINT "hashtag_messages_pk" PRIMARY KEY("hashtag_id","message_id") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "hashtags" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "hashtag" text NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "likes" ( - "user_id" uuid NOT NULL, - "message_id" uuid NOT NULL, - "like" integer DEFAULT 0 NOT NULL, - CONSTRAINT "likes_pk" PRIMARY KEY("user_id","message_id") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "messages" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "user_id" uuid NOT NULL, - "parent_id" uuid, - "message" text NOT NULL, - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "user_follows" ( - "user_id" uuid NOT NULL, - "following_user_id" uuid NOT NULL, - CONSTRAINT "user_follows_pk" PRIMARY KEY("user_id","following_user_id") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "users" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "user_id" uuid NOT NULL, - "username" text NOT NULL, - "email" text NOT NULL, - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone, - "bio" text, - "avatar" text -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "hashtag_messages" ADD CONSTRAINT "hashtag_messages_hashtag_id_hashtags_id_fk" FOREIGN KEY ("hashtag_id") REFERENCES "public"."hashtags"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "hashtag_messages" ADD CONSTRAINT "hashtag_messages_message_id_messages_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "likes" ADD CONSTRAINT "likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "likes" ADD CONSTRAINT "likes_message_id_messages_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "messages" ADD CONSTRAINT "messages_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "messages" ADD CONSTRAINT "messages_parent_id_messages_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_following_user_id_users_id_fk" FOREIGN KEY ("following_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "users" ADD CONSTRAINT "users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE cascade; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -CREATE INDEX IF NOT EXISTS "hashtag_messages_hashtag_id_idx" ON "hashtag_messages" USING btree ("hashtag_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "hashtag_messages_message_id_idx" ON "hashtag_messages" USING btree ("message_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "hashtags_hashtag_idx" ON "hashtags" USING btree ("hashtag");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "messages_user_id_idx" ON "messages" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "messages_parent_id_idx" ON "messages" USING btree ("parent_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "user_follows_user_id_idx" ON "user_follows" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "user_follows_following_user_id_idx" ON "user_follows" USING btree ("following_user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "users_username_idx" ON "users" USING btree ("username");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "users_email_idx" ON "users" USING btree ("email");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "users_user_id_idx" ON "users" USING btree ("user_id"); \ No newline at end of file diff --git a/src/db/migrations/0000_panoramic_santa_claus.sql b/src/db/migrations/20241030170954_petite_whistler.sql similarity index 50% rename from src/db/migrations/0000_panoramic_santa_claus.sql rename to src/db/migrations/20241030170954_petite_whistler.sql index f839554..7187391 100644 --- a/src/db/migrations/0000_panoramic_santa_claus.sql +++ b/src/db/migrations/20241030170954_petite_whistler.sql @@ -1,3 +1,29 @@ +-- Current sql file was generated after introspecting the database +-- If you want to run this migration please uncomment this code before executing migrations +/* +CREATE TABLE IF NOT EXISTS "characters" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "characters_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" text NOT NULL, + "description" text[] NOT NULL, + "element_id" integer NOT NULL, + "city_id" integer NOT NULL, + CONSTRAINT "characters_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "cities" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "cities_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" text NOT NULL, + CONSTRAINT "cities_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "elements" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "elements_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" text NOT NULL, + "colour" text NOT NULL, + CONSTRAINT "elements_name_unique" UNIQUE("name"), + CONSTRAINT "elements_colour_unique" UNIQUE("colour") +); +--> statement-breakpoint CREATE TABLE IF NOT EXISTS "gamestate" ( "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "gamestats_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), "playername" text NOT NULL, @@ -12,21 +38,12 @@ CREATE TABLE IF NOT EXISTS "gamestate" ( "items" json[] NOT NULL ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "items_required_items" ( - "item_id" integer NOT NULL, - "required_id" integer NOT NULL, - "quantity" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "items_required_items_item_id_required_id_pk" PRIMARY KEY("item_id","required_id") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "items_required_research" ( - "item_id" integer NOT NULL, - "required_id" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "items_required_research_item_id_required_id_pk" PRIMARY KEY("item_id","required_id") +CREATE TABLE IF NOT EXISTS "hashtags" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "hashtag" text NOT NULL ); --> statement-breakpoint +ALTER TABLE "hashtags" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint CREATE TABLE IF NOT EXISTS "levels" ( "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "levels_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), "level" integer NOT NULL, @@ -37,6 +54,16 @@ CREATE TABLE IF NOT EXISTS "levels" ( "critDamage" real NOT NULL ); --> statement-breakpoint +CREATE TABLE IF NOT EXISTS "messages" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "user_id" uuid NOT NULL, + "parent_id" uuid, + "message" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone +); +--> statement-breakpoint +ALTER TABLE "messages" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint CREATE TABLE IF NOT EXISTS "research" ( "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "research_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), "name" text NOT NULL, @@ -44,21 +71,6 @@ CREATE TABLE IF NOT EXISTS "research" ( "cost" integer NOT NULL ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "research_required_items" ( - "research_id" integer NOT NULL, - "item_id" integer NOT NULL, - "quantity" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "research_required_items_research_id_item_id_pk" PRIMARY KEY("research_id","item_id") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "research_required_research" ( - "research_id" integer NOT NULL, - "required_id" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "research_required_research_research_id_required_id_pk" PRIMARY KEY("research_id","required_id") -); ---> statement-breakpoint CREATE TABLE IF NOT EXISTS "shop_items" ( "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "shop_items_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), "name" text NOT NULL, @@ -70,21 +82,34 @@ CREATE TABLE IF NOT EXISTS "shop_items" ( "critDamage" real NOT NULL ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "upgrade_required_items" ( - "upgrade_id" integer NOT NULL, - "item_id" integer NOT NULL, - "quantity" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "upgrade_required_items_upgrade_id_item_id_pk" PRIMARY KEY("upgrade_id","item_id") +CREATE TABLE IF NOT EXISTS "tilez_games" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "game_id" text NOT NULL, + "user_id" uuid NOT NULL, + "game_start" timestamp, + "game_end" timestamp DEFAULT now(), + "num_moves" integer DEFAULT 0, + "completed" boolean DEFAULT false ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "upgrade_required_research" ( - "upgrade_id" integer NOT NULL, - "required_id" integer NOT NULL, - "description" text NOT NULL, - CONSTRAINT "upgrade_required_research_upgrade_id_research_id_pk" PRIMARY KEY("upgrade_id","required_id") +ALTER TABLE "tilez_games" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "tilez_words" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "word" char(6) NOT NULL, + "definition" text NOT NULL, + "last_checked" timestamp NOT NULL ); --> statement-breakpoint +ALTER TABLE "tilez_words" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "todos" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "title" text NOT NULL, + "completed" boolean DEFAULT false NOT NULL, + "user_id" uuid NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "todos" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint CREATE TABLE IF NOT EXISTS "upgrades" ( "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "upgrades_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), "name" text NOT NULL, @@ -92,91 +117,183 @@ CREATE TABLE IF NOT EXISTS "upgrades" ( "effectItemId" integer NOT NULL ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "characters" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "characters_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "name" text NOT NULL, - "description" text[] NOT NULL, - "element_id" integer NOT NULL, - "city_id" integer NOT NULL, - CONSTRAINT "characters_name_unique" UNIQUE("name") +CREATE TABLE IF NOT EXISTS "users" ( + "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, + "user_id" uuid, + "username" text NOT NULL, + "email" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone, + "bio" text, + "avatar" text ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "cities" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "cities_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "name" text NOT NULL, - CONSTRAINT "cities_name_unique" UNIQUE("name") +ALTER TABLE "users" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "hashtag_messages" ( + "hashtag_id" uuid NOT NULL, + "message_id" uuid NOT NULL, + CONSTRAINT "hashtag_messages_pk" PRIMARY KEY("hashtag_id","message_id") ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "elements" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "elements_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "name" text NOT NULL, - "colour" text NOT NULL, - CONSTRAINT "elements_name_unique" UNIQUE("name"), - CONSTRAINT "elements_colour_unique" UNIQUE("colour") +ALTER TABLE "hashtag_messages" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "user_follows" ( + "user_id" uuid NOT NULL, + "following_user_id" uuid NOT NULL, + CONSTRAINT "user_follows_pk" PRIMARY KEY("user_id","following_user_id") ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "todos" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "title" text NOT NULL, - "completed" boolean DEFAULT false NOT NULL, - "user_id" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT now() NOT NULL +ALTER TABLE "user_follows" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "items_required_research" ( + "item_id" integer NOT NULL, + "required_id" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "items_required_research_item_id_required_id_pk" PRIMARY KEY("item_id","required_id") ); --> statement-breakpoint -CREATE TABLE IF NOT EXISTS "tilez_games" ( - "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL, - "game_id" text NOT NULL, +CREATE TABLE IF NOT EXISTS "likes" ( "user_id" uuid NOT NULL, - "game_start" timestamp, - "game_end" timestamp DEFAULT now(), - "num_moves" integer DEFAULT 0, - "completed" boolean DEFAULT false + "message_id" uuid NOT NULL, + "like" integer DEFAULT 0 NOT NULL, + CONSTRAINT "likes_pk" PRIMARY KEY("user_id","message_id") +); +--> statement-breakpoint +ALTER TABLE "likes" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "research_required_research" ( + "research_id" integer NOT NULL, + "required_id" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "research_required_research_research_id_required_id_pk" PRIMARY KEY("research_id","required_id") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "upgrade_required_research" ( + "upgrade_id" integer NOT NULL, + "required_id" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "upgrade_required_research_upgrade_id_research_id_pk" PRIMARY KEY("upgrade_id","required_id") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "items_required_items" ( + "item_id" integer NOT NULL, + "required_id" integer NOT NULL, + "quantity" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "items_required_items_item_id_required_id_pk" PRIMARY KEY("item_id","required_id") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "research_required_items" ( + "research_id" integer NOT NULL, + "item_id" integer NOT NULL, + "quantity" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "research_required_items_research_id_item_id_pk" PRIMARY KEY("research_id","item_id") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "upgrade_required_items" ( + "upgrade_id" integer NOT NULL, + "item_id" integer NOT NULL, + "quantity" integer NOT NULL, + "description" text NOT NULL, + CONSTRAINT "upgrade_required_items_upgrade_id_item_id_pk" PRIMARY KEY("upgrade_id","item_id") ); --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "items_required_items" ADD CONSTRAINT "items_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "characters" ADD CONSTRAINT "characters_city_id_cities_id_fk" FOREIGN KEY ("city_id") REFERENCES "public"."cities"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "items_required_items" ADD CONSTRAINT "items_required_items_required_id_shop_items_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "characters" ADD CONSTRAINT "characters_element_id_elements_id_fk" FOREIGN KEY ("element_id") REFERENCES "public"."elements"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "items_required_research" ADD CONSTRAINT "items_required_research_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "levels" ADD CONSTRAINT "levels_upgrade_id_upgrades_id_fk" FOREIGN KEY ("upgrade_id") REFERENCES "public"."upgrades"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "items_required_research" ADD CONSTRAINT "items_required_research_required_id_research_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "messages" ADD CONSTRAINT "messages_parent_id_messages_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "levels" ADD CONSTRAINT "levels_upgrade_id_upgrades_id_fk" FOREIGN KEY ("upgrade_id") REFERENCES "public"."upgrades"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "messages" ADD CONSTRAINT "messages_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "research_required_items" ADD CONSTRAINT "research_required_items_research_id_research_id_fk" FOREIGN KEY ("research_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "tilez_games" ADD CONSTRAINT "tilez_games_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE cascade; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "research_required_items" ADD CONSTRAINT "research_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "todos" ADD CONSTRAINT "todos_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "research_required_research" ADD CONSTRAINT "research_required_research_research_id_research_id_fk" FOREIGN KEY ("research_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "upgrades" ADD CONSTRAINT "upgrades_effectItemId_shop_items_id_fk" FOREIGN KEY ("effectItemId") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "users" ADD CONSTRAINT "users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "hashtag_messages" ADD CONSTRAINT "hashtag_messages_hashtag_id_hashtags_id_fk" FOREIGN KEY ("hashtag_id") REFERENCES "public"."hashtags"("id") ON DELETE restrict ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "hashtag_messages" ADD CONSTRAINT "hashtag_messages_message_id_messages_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_following_user_id_users_id_fk" FOREIGN KEY ("following_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "items_required_research" ADD CONSTRAINT "items_required_research_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "items_required_research" ADD CONSTRAINT "items_required_research_required_id_research_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "likes" ADD CONSTRAINT "likes_message_id_messages_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "likes" ADD CONSTRAINT "likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade; EXCEPTION WHEN duplicate_object THEN null; END $$; @@ -188,13 +305,13 @@ EXCEPTION END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "upgrade_required_items" ADD CONSTRAINT "upgrade_required_items_upgrade_id_upgrades_id_fk" FOREIGN KEY ("upgrade_id") REFERENCES "public"."upgrades"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "research_required_research" ADD CONSTRAINT "research_required_research_research_id_research_id_fk" FOREIGN KEY ("research_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "upgrade_required_items" ADD CONSTRAINT "upgrade_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "upgrade_required_research" ADD CONSTRAINT "upgrade_required_research_required_id_research_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; @@ -206,41 +323,91 @@ EXCEPTION END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "upgrade_required_research" ADD CONSTRAINT "upgrade_required_research_required_id_research_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "items_required_items" ADD CONSTRAINT "items_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "upgrades" ADD CONSTRAINT "upgrades_effectItemId_shop_items_id_fk" FOREIGN KEY ("effectItemId") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "items_required_items" ADD CONSTRAINT "items_required_items_required_id_shop_items_id_fk" FOREIGN KEY ("required_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "characters" ADD CONSTRAINT "characters_element_id_elements_id_fk" FOREIGN KEY ("element_id") REFERENCES "public"."elements"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "research_required_items" ADD CONSTRAINT "research_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "characters" ADD CONSTRAINT "characters_city_id_cities_id_fk" FOREIGN KEY ("city_id") REFERENCES "public"."cities"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "research_required_items" ADD CONSTRAINT "research_required_items_research_id_research_id_fk" FOREIGN KEY ("research_id") REFERENCES "public"."research"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "todos" ADD CONSTRAINT "todos_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE no action ON UPDATE no action; + ALTER TABLE "upgrade_required_items" ADD CONSTRAINT "upgrade_required_items_item_id_shop_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."shop_items"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN - ALTER TABLE "tilez_games" ADD CONSTRAINT "tilez_games_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON DELETE cascade ON UPDATE cascade; + ALTER TABLE "upgrade_required_items" ADD CONSTRAINT "upgrade_required_items_upgrade_id_upgrades_id_fk" FOREIGN KEY ("upgrade_id") REFERENCES "public"."upgrades"("id") ON DELETE no action ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint +CREATE INDEX IF NOT EXISTS "hashtags_hashtag_idx" ON "hashtags" USING btree ("hashtag");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "messages_parent_id_idx" ON "messages" USING btree ("parent_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "messages_user_id_idx" ON "messages" USING btree ("user_id");--> statement-breakpoint CREATE INDEX IF NOT EXISTS "tilez_game_id_idx" ON "tilez_games" USING btree ("game_id");--> statement-breakpoint CREATE INDEX IF NOT EXISTS "tilez_game_user_id_idx" ON "tilez_games" USING btree ("user_id");--> statement-breakpoint - +CREATE UNIQUE INDEX IF NOT EXISTS "tilez_word_word_idx" ON "tilez_words" USING btree ("word");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "todos_user_id_idx" ON "todos" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "users_email_idx" ON "users" USING btree ("email");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "users_user_id_idx" ON "users" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "users_username_idx" ON "users" USING btree ("username");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "hashtag_messages_hashtag_id_idx" ON "hashtag_messages" USING btree ("hashtag_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "hashtag_messages_message_id_idx" ON "hashtag_messages" USING btree ("message_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "user_follows_following_user_id_idx" ON "user_follows" USING btree ("following_user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "user_follows_user_id_idx" ON "user_follows" USING btree ("user_id");--> statement-breakpoint +CREATE POLICY "hashtags_delete_policy" ON "hashtags" AS PERMISSIVE FOR DELETE TO "authenticated" USING (true);--> statement-breakpoint +CREATE POLICY "hashtags_insert_policy" ON "hashtags" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "hashtags_select_policy" ON "hashtags" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "hashtags_update_policy" ON "hashtags" AS PERMISSIVE FOR UPDATE TO "authenticated";--> statement-breakpoint +CREATE POLICY "messages_delete_policy" ON "messages" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid)))));--> statement-breakpoint +CREATE POLICY "messages_insert_policy" ON "messages" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "messages_select_policy" ON "messages" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "messages_update_policy" ON "messages" AS PERMISSIVE FOR UPDATE TO public;--> statement-breakpoint +CREATE POLICY "tilez_delete_policy" ON "tilez_games" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((( SELECT auth.uid() AS uid) = user_id));--> statement-breakpoint +CREATE POLICY "tilez_insert_policy" ON "tilez_games" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "tilez_select_policy" ON "tilez_games" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "tilez_update_policy" ON "tilez_games" AS PERMISSIVE FOR UPDATE TO public;--> statement-breakpoint +CREATE POLICY "todos_delete_policy" ON "todos" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((( SELECT auth.uid() AS uid) = user_id));--> statement-breakpoint +CREATE POLICY "todos_insert_policy" ON "todos" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "todos_select_policy" ON "todos" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "todos_update_policy" ON "todos" AS PERMISSIVE FOR UPDATE TO public;--> statement-breakpoint +CREATE POLICY "users_delete_policy" ON "users" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((( SELECT auth.uid() AS uid) = user_id));--> statement-breakpoint +CREATE POLICY "users_insert_policy" ON "users" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "users_select_policy" ON "users" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "users_update_policy" ON "users" AS PERMISSIVE FOR UPDATE TO public;--> statement-breakpoint +CREATE POLICY "hashtag_messages_delete_policy" ON "hashtag_messages" AS PERMISSIVE FOR DELETE TO "authenticated" USING (true);--> statement-breakpoint +CREATE POLICY "hashtag_messages_insert_policy" ON "hashtag_messages" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "hashtag_messages_select_policy" ON "hashtag_messages" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "hashtag_messages_update_policy" ON "hashtag_messages" AS PERMISSIVE FOR UPDATE TO "authenticated";--> statement-breakpoint +CREATE POLICY "user_follows_delete_policy" ON "user_follows" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid)))));--> statement-breakpoint +CREATE POLICY "user_follows_insert_policy" ON "user_follows" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "user_follows_select_policy" ON "user_follows" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "user_follows_update_policy" ON "user_follows" AS PERMISSIVE FOR UPDATE TO public;--> statement-breakpoint +CREATE POLICY "likes_delete_policy" ON "likes" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid)))));--> statement-breakpoint +CREATE POLICY "likes_insert_policy" ON "likes" AS PERMISSIVE FOR INSERT TO "authenticated";--> statement-breakpoint +CREATE POLICY "likes_select_policy" ON "likes" AS PERMISSIVE FOR SELECT TO public;--> statement-breakpoint +CREATE POLICY "likes_update_policy" ON "likes" AS PERMISSIVE FOR UPDATE TO public; +*/ \ No newline at end of file diff --git a/src/db/migrations/meta/0000_snapshot.json b/src/db/migrations/meta/0000_snapshot.json deleted file mode 100644 index e95c24a..0000000 --- a/src/db/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,1090 +0,0 @@ -{ - "id": "d264b841-f9d6-4cca-a2f2-b0cc62a4eacd", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.gamestate": { - "name": "gamestate", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "gamestats_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "playername": { - "name": "playername", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "theme": { - "name": "theme", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "currentscore": { - "name": "currentscore", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "totalclicks": { - "name": "totalclicks", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "totalspent": { - "name": "totalspent", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "currentaveragecps": { - "name": "currentaveragecps", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "averageclickvalue": { - "name": "averageclickvalue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "researched": { - "name": "researched", - "type": "integer[]", - "primaryKey": false, - "notNull": true - }, - "upgrades": { - "name": "upgrades", - "type": "json[]", - "primaryKey": false, - "notNull": true - }, - "items": { - "name": "items", - "type": "json[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.items_required_items": { - "name": "items_required_items", - "schema": "", - "columns": { - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "items_required_items_item_id_shop_items_id_fk": { - "name": "items_required_items_item_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_items_required_id_shop_items_id_fk": { - "name": "items_required_items_required_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "items_required_items_item_id_required_id_pk": { - "name": "items_required_items_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.items_required_research": { - "name": "items_required_research", - "schema": "", - "columns": { - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "items_required_research_item_id_shop_items_id_fk": { - "name": "items_required_research_item_id_shop_items_id_fk", - "tableFrom": "items_required_research", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_research_required_id_research_id_fk": { - "name": "items_required_research_required_id_research_id_fk", - "tableFrom": "items_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "items_required_research_item_id_required_id_pk": { - "name": "items_required_research_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.levels": { - "name": "levels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "levels_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "level": { - "name": "level", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "baseValue": { - "name": "baseValue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critChance": { - "name": "critChance", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critDamage": { - "name": "critDamage", - "type": "real", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "levels_upgrade_id_upgrades_id_fk": { - "name": "levels_upgrade_id_upgrades_id_fk", - "tableFrom": "levels", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.research": { - "name": "research", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "research_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.research_required_items": { - "name": "research_required_items", - "schema": "", - "columns": { - "research_id": { - "name": "research_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_items_research_id_research_id_fk": { - "name": "research_required_items_research_id_research_id_fk", - "tableFrom": "research_required_items", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_items_item_id_shop_items_id_fk": { - "name": "research_required_items_item_id_shop_items_id_fk", - "tableFrom": "research_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_items_research_id_item_id_pk": { - "name": "research_required_items_research_id_item_id_pk", - "columns": [ - "research_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.research_required_research": { - "name": "research_required_research", - "schema": "", - "columns": { - "research_id": { - "name": "research_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_research_research_id_research_id_fk": { - "name": "research_required_research_research_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_research_required_id_research_id_fk": { - "name": "research_required_research_required_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_research_research_id_required_id_pk": { - "name": "research_required_research_research_id_required_id_pk", - "columns": [ - "research_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.shop_items": { - "name": "shop_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "shop_items_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "maxQty": { - "name": "maxQty", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "multiplier": { - "name": "multiplier", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "baseValue": { - "name": "baseValue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critChance": { - "name": "critChance", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critDamage": { - "name": "critDamage", - "type": "real", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.upgrade_required_items": { - "name": "upgrade_required_items", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_items_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_items_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_items_item_id_shop_items_id_fk": { - "name": "upgrade_required_items_item_id_shop_items_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_items_upgrade_id_item_id_pk": { - "name": "upgrade_required_items_upgrade_id_item_id_pk", - "columns": [ - "upgrade_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrade_required_research": { - "name": "upgrade_required_research", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_research_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_research_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_research_required_id_research_id_fk": { - "name": "upgrade_required_research_required_id_research_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_research_upgrade_id_research_id_pk": { - "name": "upgrade_required_research_upgrade_id_research_id_pk", - "columns": [ - "upgrade_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrades": { - "name": "upgrades", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "upgrades_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "effectItemId": { - "name": "effectItemId", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrades_effectItemId_shop_items_id_fk": { - "name": "upgrades_effectItemId_shop_items_id_fk", - "tableFrom": "upgrades", - "tableTo": "shop_items", - "columnsFrom": [ - "effectItemId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.characters": { - "name": "characters", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "characters_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text[]", - "primaryKey": false, - "notNull": true - }, - "element_id": { - "name": "element_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "city_id": { - "name": "city_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "characters_element_id_elements_id_fk": { - "name": "characters_element_id_elements_id_fk", - "tableFrom": "characters", - "tableTo": "elements", - "columnsFrom": [ - "element_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "characters_city_id_cities_id_fk": { - "name": "characters_city_id_cities_id_fk", - "tableFrom": "characters", - "tableTo": "cities", - "columnsFrom": [ - "city_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "characters_name_unique": { - "name": "characters_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "public.cities": { - "name": "cities", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cities_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "cities_name_unique": { - "name": "cities_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "public.elements": { - "name": "elements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "elements_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "colour": { - "name": "colour", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "elements_name_unique": { - "name": "elements_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - }, - "elements_colour_unique": { - "name": "elements_colour_unique", - "nullsNotDistinct": false, - "columns": [ - "colour" - ] - } - } - }, - "public.todos": { - "name": "todos", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "completed": { - "name": "completed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "todos_user_id_users_id_fk": { - "name": "todos_user_id_users_id_fk", - "tableFrom": "todos", - "tableTo": "users", - "schemaTo": "auth", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.tilez_games": { - "name": "tilez_games", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "game_id": { - "name": "game_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "game_start": { - "name": "game_start", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "game_end": { - "name": "game_end", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "num_moves": { - "name": "num_moves", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "completed": { - "name": "completed", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - } - }, - "indexes": { - "tilez_game_id_idx": { - "name": "tilez_game_id_idx", - "columns": [ - { - "expression": "game_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "tilez_game_user_id_idx": { - "name": "tilez_game_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "tilez_games_user_id_users_id_fk": { - "name": "tilez_games_user_id_users_id_fk", - "tableFrom": "tilez_games", - "tableTo": "users", - "schemaTo": "auth", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/src/db/migrations/meta/0001_snapshot.json b/src/db/migrations/meta/0001_snapshot.json deleted file mode 100644 index b8b63f9..0000000 --- a/src/db/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,1141 +0,0 @@ -{ - "id": "fd0e3382-ae72-4d1e-963b-91378e43f0d9", - "prevId": "d264b841-f9d6-4cca-a2f2-b0cc62a4eacd", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.gamestate": { - "name": "gamestate", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "gamestats_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "playername": { - "name": "playername", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "theme": { - "name": "theme", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "currentscore": { - "name": "currentscore", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "totalclicks": { - "name": "totalclicks", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "totalspent": { - "name": "totalspent", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "currentaveragecps": { - "name": "currentaveragecps", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "averageclickvalue": { - "name": "averageclickvalue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "researched": { - "name": "researched", - "type": "integer[]", - "primaryKey": false, - "notNull": true - }, - "upgrades": { - "name": "upgrades", - "type": "json[]", - "primaryKey": false, - "notNull": true - }, - "items": { - "name": "items", - "type": "json[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.items_required_items": { - "name": "items_required_items", - "schema": "", - "columns": { - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "items_required_items_item_id_shop_items_id_fk": { - "name": "items_required_items_item_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_items_required_id_shop_items_id_fk": { - "name": "items_required_items_required_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "items_required_items_item_id_required_id_pk": { - "name": "items_required_items_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.items_required_research": { - "name": "items_required_research", - "schema": "", - "columns": { - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "items_required_research_item_id_shop_items_id_fk": { - "name": "items_required_research_item_id_shop_items_id_fk", - "tableFrom": "items_required_research", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_research_required_id_research_id_fk": { - "name": "items_required_research_required_id_research_id_fk", - "tableFrom": "items_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "items_required_research_item_id_required_id_pk": { - "name": "items_required_research_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.levels": { - "name": "levels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "levels_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "level": { - "name": "level", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "baseValue": { - "name": "baseValue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critChance": { - "name": "critChance", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critDamage": { - "name": "critDamage", - "type": "real", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "levels_upgrade_id_upgrades_id_fk": { - "name": "levels_upgrade_id_upgrades_id_fk", - "tableFrom": "levels", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.research": { - "name": "research", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "research_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.research_required_items": { - "name": "research_required_items", - "schema": "", - "columns": { - "research_id": { - "name": "research_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_items_research_id_research_id_fk": { - "name": "research_required_items_research_id_research_id_fk", - "tableFrom": "research_required_items", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_items_item_id_shop_items_id_fk": { - "name": "research_required_items_item_id_shop_items_id_fk", - "tableFrom": "research_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_items_research_id_item_id_pk": { - "name": "research_required_items_research_id_item_id_pk", - "columns": [ - "research_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.research_required_research": { - "name": "research_required_research", - "schema": "", - "columns": { - "research_id": { - "name": "research_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_research_research_id_research_id_fk": { - "name": "research_required_research_research_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_research_required_id_research_id_fk": { - "name": "research_required_research_required_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_research_research_id_required_id_pk": { - "name": "research_required_research_research_id_required_id_pk", - "columns": [ - "research_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.shop_items": { - "name": "shop_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "shop_items_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "maxQty": { - "name": "maxQty", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "multiplier": { - "name": "multiplier", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "baseValue": { - "name": "baseValue", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critChance": { - "name": "critChance", - "type": "real", - "primaryKey": false, - "notNull": true - }, - "critDamage": { - "name": "critDamage", - "type": "real", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.upgrade_required_items": { - "name": "upgrade_required_items", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_items_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_items_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_items_item_id_shop_items_id_fk": { - "name": "upgrade_required_items_item_id_shop_items_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_items_upgrade_id_item_id_pk": { - "name": "upgrade_required_items_upgrade_id_item_id_pk", - "columns": [ - "upgrade_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrade_required_research": { - "name": "upgrade_required_research", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_research_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_research_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_research_required_id_research_id_fk": { - "name": "upgrade_required_research_required_id_research_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_research_upgrade_id_research_id_pk": { - "name": "upgrade_required_research_upgrade_id_research_id_pk", - "columns": [ - "upgrade_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrades": { - "name": "upgrades", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "upgrades_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "effectItemId": { - "name": "effectItemId", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrades_effectItemId_shop_items_id_fk": { - "name": "upgrades_effectItemId_shop_items_id_fk", - "tableFrom": "upgrades", - "tableTo": "shop_items", - "columnsFrom": [ - "effectItemId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.characters": { - "name": "characters", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "characters_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text[]", - "primaryKey": false, - "notNull": true - }, - "element_id": { - "name": "element_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "city_id": { - "name": "city_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "characters_element_id_elements_id_fk": { - "name": "characters_element_id_elements_id_fk", - "tableFrom": "characters", - "tableTo": "elements", - "columnsFrom": [ - "element_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "characters_city_id_cities_id_fk": { - "name": "characters_city_id_cities_id_fk", - "tableFrom": "characters", - "tableTo": "cities", - "columnsFrom": [ - "city_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "characters_name_unique": { - "name": "characters_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "public.cities": { - "name": "cities", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "cities_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "cities_name_unique": { - "name": "cities_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "public.elements": { - "name": "elements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "elements_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "colour": { - "name": "colour", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "elements_name_unique": { - "name": "elements_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - }, - "elements_colour_unique": { - "name": "elements_colour_unique", - "nullsNotDistinct": false, - "columns": [ - "colour" - ] - } - } - }, - "public.todos": { - "name": "todos", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "completed": { - "name": "completed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "todos_user_id_users_id_fk": { - "name": "todos_user_id_users_id_fk", - "tableFrom": "todos", - "tableTo": "users", - "schemaTo": "auth", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.tilez_games": { - "name": "tilez_games", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "game_id": { - "name": "game_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "game_start": { - "name": "game_start", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "game_end": { - "name": "game_end", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "num_moves": { - "name": "num_moves", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "completed": { - "name": "completed", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - } - }, - "indexes": { - "tilez_game_id_idx": { - "name": "tilez_game_id_idx", - "columns": [ - { - "expression": "game_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "tilez_game_user_id_idx": { - "name": "tilez_game_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "tilez_games_user_id_users_id_fk": { - "name": "tilez_games_user_id_users_id_fk", - "tableFrom": "tilez_games", - "tableTo": "users", - "schemaTo": "auth", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.tilez_words": { - "name": "tilez_words", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "word": { - "name": "word", - "type": "char(6)", - "primaryKey": false, - "notNull": true - }, - "definition": { - "name": "definition", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_checked": { - "name": "last_checked", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "tilez_word_word_idx": { - "name": "tilez_word_word_idx", - "columns": [ - { - "expression": "word", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/src/db/migrations/meta/0002_snapshot.json b/src/db/migrations/meta/20241030170954_snapshot.json similarity index 74% rename from src/db/migrations/meta/0002_snapshot.json rename to src/db/migrations/meta/20241030170954_snapshot.json index 2114387..db08218 100644 --- a/src/db/migrations/meta/0002_snapshot.json +++ b/src/db/migrations/meta/20241030170954_snapshot.json @@ -1,9 +1,201 @@ { - "id": "9983c50b-8910-493e-a9df-ee6241b3295e", - "prevId": "fd0e3382-ae72-4d1e-963b-91378e43f0d9", + "id": "00000000-0000-0000-0000-000000000000", + "prevId": "", "version": "7", "dialect": "postgresql", "tables": { + "public.characters": { + "name": "characters", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "characters_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "element_id": { + "name": "element_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "city_id": { + "name": "city_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "characters_city_id_cities_id_fk": { + "name": "characters_city_id_cities_id_fk", + "tableFrom": "characters", + "tableTo": "cities", + "schemaTo": "public", + "columnsFrom": [ + "city_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "characters_element_id_elements_id_fk": { + "name": "characters_element_id_elements_id_fk", + "tableFrom": "characters", + "tableTo": "elements", + "schemaTo": "public", + "columnsFrom": [ + "element_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "characters_name_unique": { + "columns": [ + "name" + ], + "nullsNotDistinct": false, + "name": "characters_name_unique" + } + }, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, + "public.cities": { + "name": "cities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "cities_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "cities_name_unique": { + "columns": [ + "name" + ], + "nullsNotDistinct": false, + "name": "cities_name_unique" + } + }, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, + "public.elements": { + "name": "elements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "elements_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "colour": { + "name": "colour", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "elements_name_unique": { + "columns": [ + "name" + ], + "nullsNotDistinct": false, + "name": "elements_name_unique" + }, + "elements_colour_unique": { + "columns": [ + "colour" + ], + "nullsNotDistinct": false, + "name": "elements_colour_unique" + } + }, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, "public.gamestate": { "name": "gamestate", "schema": "", @@ -16,13 +208,13 @@ "identity": { "type": "always", "name": "gamestats_id_seq", - "schema": "public", "increment": "1", - "startWith": "1", "minValue": "1", "maxValue": "2147483647", + "startWith": "1", "cache": "1", - "cycle": false + "cycle": false, + "schema": "public" } }, "playername": { @@ -89,121 +281,155 @@ "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.items_required_items": { - "name": "items_required_items", + "public.hashtags": { + "name": "hashtags", "schema": "", "columns": { - "item_id": { - "name": "item_id", + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v4()" + }, + "hashtag": { + "name": "hashtag", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "hashtags_hashtag_idx": { + "name": "hashtags_hashtag_idx", + "columns": [ + { + "expression": "hashtag", + "asc": true, + "nulls": "last", + "opclass": "text_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "hashtags_delete_policy": { + "name": "hashtags_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "true" + }, + "hashtags_insert_policy": { + "name": "hashtags_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "hashtags_select_policy": { + "name": "hashtags_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "hashtags_update_policy": { + "name": "hashtags_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "authenticated" + ] + } + }, + "isRLSEnabled": true + }, + "public.levels": { + "name": "levels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "levels_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "level": { + "name": "level", "type": "integer", "primaryKey": false, "notNull": true }, - "required_id": { - "name": "required_id", + "upgrade_id": { + "name": "upgrade_id", "type": "integer", "primaryKey": false, "notNull": true }, - "quantity": { - "name": "quantity", + "cost": { + "name": "cost", "type": "integer", "primaryKey": false, "notNull": true }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "items_required_items_item_id_shop_items_id_fk": { - "name": "items_required_items_item_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_items_required_id_shop_items_id_fk": { - "name": "items_required_items_required_id_shop_items_id_fk", - "tableFrom": "items_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "items_required_items_item_id_required_id_pk": { - "name": "items_required_items_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.items_required_research": { - "name": "items_required_research", - "schema": "", - "columns": { - "item_id": { - "name": "item_id", - "type": "integer", + "baseValue": { + "name": "baseValue", + "type": "real", "primaryKey": false, "notNull": true }, - "required_id": { - "name": "required_id", - "type": "integer", + "critChance": { + "name": "critChance", + "type": "real", "primaryKey": false, "notNull": true }, - "description": { - "name": "description", - "type": "text", + "critDamage": { + "name": "critDamage", + "type": "real", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { - "items_required_research_item_id_shop_items_id_fk": { - "name": "items_required_research_item_id_shop_items_id_fk", - "tableFrom": "items_required_research", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "items_required_research_required_id_research_id_fk": { - "name": "items_required_research_required_id_research_id_fk", - "tableFrom": "items_required_research", - "tableTo": "research", + "levels_upgrade_id_upgrades_id_fk": { + "name": "levels_upgrade_id_upgrades_id_fk", + "tableFrom": "levels", + "tableTo": "upgrades", + "schemaTo": "public", "columnsFrom": [ - "required_id" + "upgrade_id" ], "columnsTo": [ "id" @@ -212,93 +438,158 @@ "onUpdate": "no action" } }, - "compositePrimaryKeys": { - "items_required_research_item_id_required_id_pk": { - "name": "items_required_research_item_id_required_id_pk", - "columns": [ - "item_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.levels": { - "name": "levels", + "public.messages": { + "name": "messages", "schema": "", "columns": { "id": { "name": "id", - "type": "integer", + "type": "uuid", "primaryKey": true, "notNull": true, - "identity": { - "type": "always", - "name": "levels_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } + "default": "uuid_generate_v4()" }, - "level": { - "name": "level", - "type": "integer", + "user_id": { + "name": "user_id", + "type": "uuid", "primaryKey": false, "notNull": true }, - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", + "parent_id": { + "name": "parent_id", + "type": "uuid", "primaryKey": false, - "notNull": true + "notNull": false }, - "cost": { - "name": "cost", - "type": "integer", + "message": { + "name": "message", + "type": "text", "primaryKey": false, "notNull": true }, - "baseValue": { - "name": "baseValue", - "type": "real", + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, - "critChance": { - "name": "critChance", - "type": "real", + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", "primaryKey": false, - "notNull": true + "notNull": false + } + }, + "indexes": { + "messages_parent_id_idx": { + "name": "messages_parent_id_idx", + "columns": [ + { + "expression": "parent_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} }, - "critDamage": { - "name": "critDamage", - "type": "real", - "primaryKey": false, - "notNull": true + "messages_user_id_idx": { + "name": "messages_user_id_idx", + "columns": [ + { + "expression": "user_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} } }, - "indexes": {}, "foreignKeys": { - "levels_upgrade_id_upgrades_id_fk": { - "name": "levels_upgrade_id_upgrades_id_fk", - "tableFrom": "levels", - "tableTo": "upgrades", + "messages_parent_id_messages_id_fk": { + "name": "messages_parent_id_messages_id_fk", + "tableFrom": "messages", + "tableTo": "messages", + "schemaTo": "public", "columnsFrom": [ - "upgrade_id" + "parent_id" ], "columnsTo": [ "id" ], - "onDelete": "no action", - "onUpdate": "no action" + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "messages_user_id_users_id_fk": { + "name": "messages_user_id_users_id_fk", + "tableFrom": "messages", + "tableTo": "users", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "messages_delete_policy": { + "name": "messages_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(user_id IN ( SELECT users.id\n FROM users\n WHERE (users.user_id = ( SELECT auth.uid() AS uid))))" + }, + "messages_insert_policy": { + "name": "messages_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "messages_select_policy": { + "name": "messages_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "messages_update_policy": { + "name": "messages_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" + ] + } + }, + "isRLSEnabled": true }, "public.research": { "name": "research", @@ -312,13 +603,13 @@ "identity": { "type": "always", "name": "research_id_seq", - "schema": "public", "increment": "1", - "startWith": "1", "minValue": "1", "maxValue": "2147483647", + "startWith": "1", "cache": "1", - "cycle": false + "cycle": false, + "schema": "public" } }, "name": { @@ -343,182 +634,53 @@ "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.research_required_items": { - "name": "research_required_items", + "public.shop_items": { + "name": "shop_items", "schema": "", "columns": { - "research_id": { - "name": "research_id", + "id": { + "name": "id", "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "shop_items_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "name": { + "name": "name", + "type": "text", "primaryKey": false, "notNull": true }, - "item_id": { - "name": "item_id", + "cost": { + "name": "cost", "type": "integer", "primaryKey": false, "notNull": true }, - "quantity": { - "name": "quantity", + "maxQty": { + "name": "maxQty", "type": "integer", "primaryKey": false, "notNull": true }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_items_research_id_research_id_fk": { - "name": "research_required_items_research_id_research_id_fk", - "tableFrom": "research_required_items", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_items_item_id_shop_items_id_fk": { - "name": "research_required_items_item_id_shop_items_id_fk", - "tableFrom": "research_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_items_research_id_item_id_pk": { - "name": "research_required_items_research_id_item_id_pk", - "columns": [ - "research_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.research_required_research": { - "name": "research_required_research", - "schema": "", - "columns": { - "research_id": { - "name": "research_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "research_required_research_research_id_research_id_fk": { - "name": "research_required_research_research_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "research_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "research_required_research_required_id_research_id_fk": { - "name": "research_required_research_required_id_research_id_fk", - "tableFrom": "research_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "research_required_research_research_id_required_id_pk": { - "name": "research_required_research_research_id_required_id_pk", - "columns": [ - "research_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.shop_items": { - "name": "shop_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "shop_items_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cost": { - "name": "cost", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "maxQty": { - "name": "maxQty", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "multiplier": { - "name": "multiplier", - "type": "real", + "multiplier": { + "name": "multiplier", + "type": "real", "primaryKey": false, "notNull": true }, @@ -544,379 +706,206 @@ "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.upgrade_required_items": { - "name": "upgrade_required_items", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_items_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_items_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_items_item_id_shop_items_id_fk": { - "name": "upgrade_required_items_item_id_shop_items_id_fk", - "tableFrom": "upgrade_required_items", - "tableTo": "shop_items", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_items_upgrade_id_item_id_pk": { - "name": "upgrade_required_items_upgrade_id_item_id_pk", - "columns": [ - "upgrade_id", - "item_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrade_required_research": { - "name": "upgrade_required_research", - "schema": "", - "columns": { - "upgrade_id": { - "name": "upgrade_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "required_id": { - "name": "required_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrade_required_research_upgrade_id_upgrades_id_fk": { - "name": "upgrade_required_research_upgrade_id_upgrades_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "upgrades", - "columnsFrom": [ - "upgrade_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "upgrade_required_research_required_id_research_id_fk": { - "name": "upgrade_required_research_required_id_research_id_fk", - "tableFrom": "upgrade_required_research", - "tableTo": "research", - "columnsFrom": [ - "required_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "upgrade_required_research_upgrade_id_research_id_pk": { - "name": "upgrade_required_research_upgrade_id_research_id_pk", - "columns": [ - "upgrade_id", - "required_id" - ] - } - }, - "uniqueConstraints": {} - }, - "public.upgrades": { - "name": "upgrades", + "public.tilez_games": { + "name": "tilez_games", "schema": "", "columns": { "id": { "name": "id", - "type": "integer", + "type": "uuid", "primaryKey": true, "notNull": true, - "identity": { - "type": "always", - "name": "upgrades_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } + "default": "uuid_generate_v4()" }, - "name": { - "name": "name", + "game_id": { + "name": "game_id", "type": "text", "primaryKey": false, "notNull": true }, - "description": { - "name": "description", - "type": "text", + "user_id": { + "name": "user_id", + "type": "uuid", "primaryKey": false, "notNull": true }, - "effectItemId": { - "name": "effectItemId", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "upgrades_effectItemId_shop_items_id_fk": { - "name": "upgrades_effectItemId_shop_items_id_fk", - "tableFrom": "upgrades", - "tableTo": "shop_items", - "columnsFrom": [ - "effectItemId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.characters": { - "name": "characters", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "characters_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "name": { - "name": "name", - "type": "text", + "game_start": { + "name": "game_start", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": false }, - "description": { - "name": "description", - "type": "text[]", + "game_end": { + "name": "game_end", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": false, + "default": "now()" }, - "element_id": { - "name": "element_id", + "num_moves": { + "name": "num_moves", "type": "integer", "primaryKey": false, - "notNull": true + "notNull": false, + "default": 0 }, - "city_id": { - "name": "city_id", - "type": "integer", + "completed": { + "name": "completed", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": false, + "default": false } }, - "indexes": {}, - "foreignKeys": { - "characters_element_id_elements_id_fk": { - "name": "characters_element_id_elements_id_fk", - "tableFrom": "characters", - "tableTo": "elements", - "columnsFrom": [ - "element_id" - ], - "columnsTo": [ - "id" + "indexes": { + "tilez_game_id_idx": { + "name": "tilez_game_id_idx", + "columns": [ + { + "expression": "game_id", + "asc": true, + "nulls": "last", + "opclass": "text_ops", + "isExpression": false + } ], - "onDelete": "no action", - "onUpdate": "no action" + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} }, - "characters_city_id_cities_id_fk": { - "name": "characters_city_id_cities_id_fk", - "tableFrom": "characters", - "tableTo": "cities", + "tilez_game_user_id_idx": { + "name": "tilez_game_user_id_idx", + "columns": [ + { + "expression": "user_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tilez_games_user_id_users_id_fk": { + "name": "tilez_games_user_id_users_id_fk", + "tableFrom": "tilez_games", + "tableTo": "users", + "schemaTo": "auth", "columnsFrom": [ - "city_id" + "user_id" ], "columnsTo": [ "id" ], - "onDelete": "no action", - "onUpdate": "no action" + "onDelete": "cascade", + "onUpdate": "cascade" } }, "compositePrimaryKeys": {}, - "uniqueConstraints": { - "characters_name_unique": { - "name": "characters_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "tilez_delete_policy": { + "name": "tilez_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(( SELECT auth.uid() AS uid) = user_id)" + }, + "tilez_insert_policy": { + "name": "tilez_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "tilez_select_policy": { + "name": "tilez_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "tilez_update_policy": { + "name": "tilez_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" ] } - } + }, + "isRLSEnabled": true }, - "public.cities": { - "name": "cities", + "public.tilez_words": { + "name": "tilez_words", "schema": "", "columns": { "id": { "name": "id", - "type": "integer", + "type": "uuid", "primaryKey": true, "notNull": true, - "identity": { - "type": "always", - "name": "cities_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } + "default": "uuid_generate_v4()" }, - "name": { - "name": "name", - "type": "text", + "word": { + "name": "word", + "type": "char(6)", "primaryKey": false, "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "cities_name_unique": { - "name": "cities_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - } - } - }, - "public.elements": { - "name": "elements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "elements_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } }, - "name": { - "name": "name", + "definition": { + "name": "definition", "type": "text", "primaryKey": false, "notNull": true }, - "colour": { - "name": "colour", - "type": "text", + "last_checked": { + "name": "last_checked", + "type": "timestamp", "primaryKey": false, "notNull": true } }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "elements_name_unique": { - "name": "elements_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - }, - "elements_colour_unique": { - "name": "elements_colour_unique", - "nullsNotDistinct": false, + "indexes": { + "tilez_word_word_idx": { + "name": "tilez_word_word_idx", "columns": [ - "colour" - ] + { + "expression": "word", + "asc": true, + "nulls": "last", + "opclass": "bpchar_ops", + "isExpression": false + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} } - } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": true }, "public.todos": { "name": "todos", @@ -956,7 +945,24 @@ "default": "now()" } }, - "indexes": {}, + "indexes": { + "todos_user_id_idx": { + "name": "todos_user_id_idx", + "columns": [ + { + "expression": "user_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, "foreignKeys": { "todos_user_id_users_id_fk": { "name": "todos_user_id_users_id_fk", @@ -974,10 +980,110 @@ } }, "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "todos_delete_policy": { + "name": "todos_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(( SELECT auth.uid() AS uid) = user_id)" + }, + "todos_insert_policy": { + "name": "todos_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "todos_select_policy": { + "name": "todos_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "todos_update_policy": { + "name": "todos_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" + ] + } + }, + "isRLSEnabled": true }, - "public.tilez_games": { - "name": "tilez_games", + "public.upgrades": { + "name": "upgrades", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "upgrades_id_seq", + "increment": "1", + "minValue": "1", + "maxValue": "2147483647", + "startWith": "1", + "cache": "1", + "cycle": false, + "schema": "public" + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "effectItemId": { + "name": "effectItemId", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "upgrades_effectItemId_shop_items_id_fk": { + "name": "upgrades_effectItemId_shop_items_id_fk", + "tableFrom": "upgrades", + "tableTo": "shop_items", + "schemaTo": "public", + "columnsFrom": [ + "effectItemId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", "schema": "", "columns": { "id": { @@ -987,55 +1093,60 @@ "notNull": true, "default": "uuid_generate_v4()" }, - "game_id": { - "name": "game_id", + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", "type": "text", "primaryKey": false, "notNull": true }, - "user_id": { - "name": "user_id", - "type": "uuid", + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, - "game_start": { - "name": "game_start", - "type": "timestamp", + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, - "game_end": { - "name": "game_end", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "num_moves": { - "name": "num_moves", - "type": "integer", + "bio": { + "name": "bio", + "type": "text", "primaryKey": false, - "notNull": false, - "default": 0 + "notNull": false }, - "completed": { - "name": "completed", - "type": "boolean", + "avatar": { + "name": "avatar", + "type": "text", "primaryKey": false, - "notNull": false, - "default": false + "notNull": false } }, "indexes": { - "tilez_game_id_idx": { - "name": "tilez_game_id_idx", + "users_email_idx": { + "name": "users_email_idx", "columns": [ { - "expression": "game_id", - "isExpression": false, + "expression": "email", "asc": true, - "nulls": "last" + "nulls": "last", + "opclass": "text_ops", + "isExpression": false } ], "isUnique": false, @@ -1043,14 +1154,31 @@ "method": "btree", "with": {} }, - "tilez_game_user_id_idx": { - "name": "tilez_game_user_id_idx", + "users_user_id_idx": { + "name": "users_user_id_idx", "columns": [ { "expression": "user_id", - "isExpression": false, "asc": true, - "nulls": "last" + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_username_idx": { + "name": "users_username_idx", + "columns": [ + { + "expression": "username", + "asc": true, + "nulls": "last", + "opclass": "text_ops", + "isExpression": false } ], "isUnique": false, @@ -1060,9 +1188,9 @@ } }, "foreignKeys": { - "tilez_games_user_id_users_id_fk": { - "name": "tilez_games_user_id_users_id_fk", - "tableFrom": "tilez_games", + "users_user_id_users_id_fk": { + "name": "users_user_id_users_id_fk", + "tableFrom": "users", "tableTo": "users", "schemaTo": "auth", "columnsFrom": [ @@ -1076,58 +1204,44 @@ } }, "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.tilez_words": { - "name": "tilez_words", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "word": { - "name": "word", - "type": "char(6)", - "primaryKey": false, - "notNull": true + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "users_delete_policy": { + "name": "users_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(( SELECT auth.uid() AS uid) = user_id)" + }, + "users_insert_policy": { + "name": "users_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] }, - "definition": { - "name": "definition", - "type": "text", - "primaryKey": false, - "notNull": true + "users_select_policy": { + "name": "users_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] }, - "last_checked": { - "name": "last_checked", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "tilez_word_word_idx": { - "name": "tilez_word_word_idx", - "columns": [ - { - "expression": "word", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} + "users_update_policy": { + "name": "users_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" + ] } }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "isRLSEnabled": true }, "public.hashtag_messages": { "name": "hashtag_messages", @@ -1152,9 +1266,10 @@ "columns": [ { "expression": "hashtag_id", - "isExpression": false, "asc": true, - "nulls": "last" + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false } ], "isUnique": false, @@ -1167,9 +1282,10 @@ "columns": [ { "expression": "message_id", - "isExpression": false, "asc": true, - "nulls": "last" + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false } ], "isUnique": false, @@ -1183,19 +1299,21 @@ "name": "hashtag_messages_hashtag_id_hashtags_id_fk", "tableFrom": "hashtag_messages", "tableTo": "hashtags", + "schemaTo": "public", "columnsFrom": [ "hashtag_id" ], "columnsTo": [ "id" ], - "onDelete": "cascade", + "onDelete": "restrict", "onUpdate": "cascade" }, "hashtag_messages_message_id_messages_id_fk": { "name": "hashtag_messages_message_id_messages_id_fk", "tableFrom": "hashtag_messages", "tableTo": "messages", + "schemaTo": "public", "columnsFrom": [ "message_id" ], @@ -1215,46 +1333,241 @@ ] } }, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "hashtag_messages_delete_policy": { + "name": "hashtag_messages_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "true" + }, + "hashtag_messages_insert_policy": { + "name": "hashtag_messages_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "hashtag_messages_select_policy": { + "name": "hashtag_messages_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "hashtag_messages_update_policy": { + "name": "hashtag_messages_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "authenticated" + ] + } + }, + "isRLSEnabled": true }, - "public.hashtags": { - "name": "hashtags", + "public.user_follows": { + "name": "user_follows", "schema": "", "columns": { - "id": { - "name": "id", + "user_id": { + "name": "user_id", "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" + "primaryKey": false, + "notNull": true + }, + "following_user_id": { + "name": "following_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "user_follows_following_user_id_idx": { + "name": "user_follows_following_user_id_idx", + "columns": [ + { + "expression": "following_user_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_follows_user_id_idx": { + "name": "user_follows_user_id_idx", + "columns": [ + { + "expression": "user_id", + "asc": true, + "nulls": "last", + "opclass": "uuid_ops", + "isExpression": false + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_follows_following_user_id_users_id_fk": { + "name": "user_follows_following_user_id_users_id_fk", + "tableFrom": "user_follows", + "tableTo": "users", + "schemaTo": "public", + "columnsFrom": [ + "following_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "user_follows_user_id_users_id_fk": { + "name": "user_follows_user_id_users_id_fk", + "tableFrom": "user_follows", + "tableTo": "users", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": { + "user_follows_pk": { + "name": "user_follows_pk", + "columns": [ + "user_id", + "following_user_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "user_follows_delete_policy": { + "name": "user_follows_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(user_id IN ( SELECT users.id\n FROM users\n WHERE (users.user_id = ( SELECT auth.uid() AS uid))))" + }, + "user_follows_insert_policy": { + "name": "user_follows_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "user_follows_select_policy": { + "name": "user_follows_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "user_follows_update_policy": { + "name": "user_follows_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" + ] + } + }, + "isRLSEnabled": true + }, + "public.items_required_research": { + "name": "items_required_research", + "schema": "", + "columns": { + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "required_id": { + "name": "required_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "items_required_research_item_id_shop_items_id_fk": { + "name": "items_required_research_item_id_shop_items_id_fk", + "tableFrom": "items_required_research", + "tableTo": "shop_items", + "schemaTo": "public", + "columnsFrom": [ + "item_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" }, - "hashtag": { - "name": "hashtag", - "type": "text", - "primaryKey": false, - "notNull": true + "items_required_research_required_id_research_id_fk": { + "name": "items_required_research_required_id_research_id_fk", + "tableFrom": "items_required_research", + "tableTo": "research", + "schemaTo": "public", + "columnsFrom": [ + "required_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" } }, - "indexes": { - "hashtags_hashtag_idx": { - "name": "hashtags_hashtag_idx", + "compositePrimaryKeys": { + "items_required_research_item_id_required_id_pk": { + "name": "items_required_research_item_id_required_id_pk", "columns": [ - { - "expression": "hashtag", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} + "item_id", + "required_id" + ] } }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, "public.likes": { "name": "likes", @@ -1282,12 +1595,13 @@ }, "indexes": {}, "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", + "likes_message_id_messages_id_fk": { + "name": "likes_message_id_messages_id_fk", "tableFrom": "likes", - "tableTo": "users", + "tableTo": "messages", + "schemaTo": "public", "columnsFrom": [ - "user_id" + "message_id" ], "columnsTo": [ "id" @@ -1295,12 +1609,13 @@ "onDelete": "cascade", "onUpdate": "cascade" }, - "likes_message_id_messages_id_fk": { - "name": "likes_message_id_messages_id_fk", + "likes_user_id_users_id_fk": { + "name": "likes_user_id_users_id_fk", "tableFrom": "likes", - "tableTo": "messages", + "tableTo": "users", + "schemaTo": "public", "columnsFrom": [ - "message_id" + "user_id" ], "columnsTo": [ "id" @@ -1318,330 +1633,445 @@ ] } }, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": { + "likes_delete_policy": { + "name": "likes_delete_policy", + "as": "PERMISSIVE", + "for": "DELETE", + "to": [ + "authenticated" + ], + "using": "(user_id IN ( SELECT users.id\n FROM users\n WHERE (users.user_id = ( SELECT auth.uid() AS uid))))" + }, + "likes_insert_policy": { + "name": "likes_insert_policy", + "as": "PERMISSIVE", + "for": "INSERT", + "to": [ + "authenticated" + ] + }, + "likes_select_policy": { + "name": "likes_select_policy", + "as": "PERMISSIVE", + "for": "SELECT", + "to": [ + "public" + ] + }, + "likes_update_policy": { + "name": "likes_update_policy", + "as": "PERMISSIVE", + "for": "UPDATE", + "to": [ + "public" + ] + } + }, + "isRLSEnabled": true }, - "public.messages": { - "name": "messages", + "public.research_required_research": { + "name": "research_required_research", "schema": "", "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", + "research_id": { + "name": "research_id", + "type": "integer", "primaryKey": false, "notNull": true }, - "parent_id": { - "name": "parent_id", - "type": "uuid", + "required_id": { + "name": "required_id", + "type": "integer", "primaryKey": false, - "notNull": false + "notNull": true }, - "message": { - "name": "message", + "description": { + "name": "description", "type": "text", "primaryKey": false, "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "research_required_research_required_id_research_id_fk": { + "name": "research_required_research_required_id_research_id_fk", + "tableFrom": "research_required_research", + "tableTo": "research", + "schemaTo": "public", + "columnsFrom": [ + "required_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", + "research_required_research_research_id_research_id_fk": { + "name": "research_required_research_research_id_research_id_fk", + "tableFrom": "research_required_research", + "tableTo": "research", + "schemaTo": "public", + "columnsFrom": [ + "research_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "research_required_research_research_id_required_id_pk": { + "name": "research_required_research_research_id_required_id_pk", + "columns": [ + "research_id", + "required_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, + "public.upgrade_required_research": { + "name": "upgrade_required_research", + "schema": "", + "columns": { + "upgrade_id": { + "name": "upgrade_id", + "type": "integer", "primaryKey": false, - "notNull": true, - "default": "now()" + "notNull": true }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", + "required_id": { + "name": "required_id", + "type": "integer", "primaryKey": false, - "notNull": false + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true } }, - "indexes": { - "messages_user_id_idx": { - "name": "messages_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } + "indexes": {}, + "foreignKeys": { + "upgrade_required_research_required_id_research_id_fk": { + "name": "upgrade_required_research_required_id_research_id_fk", + "tableFrom": "upgrade_required_research", + "tableTo": "research", + "schemaTo": "public", + "columnsFrom": [ + "required_id" ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" }, - "messages_parent_id_idx": { - "name": "messages_parent_id_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } + "upgrade_required_research_upgrade_id_upgrades_id_fk": { + "name": "upgrade_required_research_upgrade_id_upgrades_id_fk", + "tableFrom": "upgrade_required_research", + "tableTo": "upgrades", + "schemaTo": "public", + "columnsFrom": [ + "upgrade_id" ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "upgrade_required_research_upgrade_id_research_id_pk": { + "name": "upgrade_required_research_upgrade_id_research_id_pk", + "columns": [ + "upgrade_id", + "required_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false + }, + "public.items_required_items": { + "name": "items_required_items", + "schema": "", + "columns": { + "item_id": { + "name": "item_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "required_id": { + "name": "required_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true } }, + "indexes": {}, "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "tableTo": "users", + "items_required_items_item_id_shop_items_id_fk": { + "name": "items_required_items_item_id_shop_items_id_fk", + "tableFrom": "items_required_items", + "tableTo": "shop_items", + "schemaTo": "public", "columnsFrom": [ - "user_id" + "item_id" ], "columnsTo": [ "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" + ], + "onDelete": "no action", + "onUpdate": "no action" }, - "messages_parent_id_messages_id_fk": { - "name": "messages_parent_id_messages_id_fk", - "tableFrom": "messages", - "tableTo": "messages", + "items_required_items_required_id_shop_items_id_fk": { + "name": "items_required_items_required_id_shop_items_id_fk", + "tableFrom": "items_required_items", + "tableTo": "shop_items", + "schemaTo": "public", "columnsFrom": [ - "parent_id" + "required_id" ], "columnsTo": [ "id" ], - "onDelete": "cascade", - "onUpdate": "cascade" + "onDelete": "no action", + "onUpdate": "no action" } }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "compositePrimaryKeys": { + "items_required_items_item_id_required_id_pk": { + "name": "items_required_items_item_id_required_id_pk", + "columns": [ + "item_id", + "required_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.user_follows": { - "name": "user_follows", + "public.research_required_items": { + "name": "research_required_items", "schema": "", "columns": { - "user_id": { - "name": "user_id", - "type": "uuid", + "research_id": { + "name": "research_id", + "type": "integer", "primaryKey": false, "notNull": true }, - "following_user_id": { - "name": "following_user_id", - "type": "uuid", + "item_id": { + "name": "item_id", + "type": "integer", "primaryKey": false, "notNull": true - } - }, - "indexes": { - "user_follows_user_id_idx": { - "name": "user_follows_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} }, - "user_follows_following_user_id_idx": { - "name": "user_follows_following_user_id_idx", - "columns": [ - { - "expression": "following_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true } }, + "indexes": {}, "foreignKeys": { - "user_follows_user_id_users_id_fk": { - "name": "user_follows_user_id_users_id_fk", - "tableFrom": "user_follows", - "tableTo": "users", + "research_required_items_item_id_shop_items_id_fk": { + "name": "research_required_items_item_id_shop_items_id_fk", + "tableFrom": "research_required_items", + "tableTo": "shop_items", + "schemaTo": "public", "columnsFrom": [ - "user_id" + "item_id" ], "columnsTo": [ "id" ], - "onDelete": "cascade", - "onUpdate": "cascade" + "onDelete": "no action", + "onUpdate": "no action" }, - "user_follows_following_user_id_users_id_fk": { - "name": "user_follows_following_user_id_users_id_fk", - "tableFrom": "user_follows", - "tableTo": "users", + "research_required_items_research_id_research_id_fk": { + "name": "research_required_items_research_id_research_id_fk", + "tableFrom": "research_required_items", + "tableTo": "research", + "schemaTo": "public", "columnsFrom": [ - "following_user_id" + "research_id" ], "columnsTo": [ "id" ], - "onDelete": "cascade", - "onUpdate": "cascade" + "onDelete": "no action", + "onUpdate": "no action" } }, "compositePrimaryKeys": { - "user_follows_pk": { - "name": "user_follows_pk", + "research_required_items_research_id_item_id_pk": { + "name": "research_required_items_research_id_item_id_pk", "columns": [ - "user_id", - "following_user_id" + "research_id", + "item_id" ] } }, - "uniqueConstraints": {} + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false }, - "public.users": { - "name": "users", + "public.upgrade_required_items": { + "name": "upgrade_required_items", "schema": "", "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "uuid_generate_v4()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", + "upgrade_id": { + "name": "upgrade_id", + "type": "integer", "primaryKey": false, "notNull": true }, - "username": { - "name": "username", - "type": "text", + "item_id": { + "name": "item_id", + "type": "integer", "primaryKey": false, "notNull": true }, - "email": { - "name": "email", - "type": "text", + "quantity": { + "name": "quantity", + "type": "integer", "primaryKey": false, "notNull": true }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar": { - "name": "avatar", + "description": { + "name": "description", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true } }, - "indexes": { - "users_username_idx": { - "name": "users_username_idx", - "columns": [ - { - "expression": "username", - "isExpression": false, - "asc": true, - "nulls": "last" - } + "indexes": {}, + "foreignKeys": { + "upgrade_required_items_item_id_shop_items_id_fk": { + "name": "upgrade_required_items_item_id_shop_items_id_fk", + "tableFrom": "upgrade_required_items", + "tableTo": "shop_items", + "schemaTo": "public", + "columnsFrom": [ + "item_id" ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } + "columnsTo": [ + "id" ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} + "onDelete": "no action", + "onUpdate": "no action" }, - "users_user_id_idx": { - "name": "users_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_user_id_users_id_fk": { - "name": "users_user_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "schemaTo": "auth", + "upgrade_required_items_upgrade_id_upgrades_id_fk": { + "name": "upgrade_required_items_upgrade_id_upgrades_id_fk", + "tableFrom": "upgrade_required_items", + "tableTo": "upgrades", + "schemaTo": "public", "columnsFrom": [ - "user_id" + "upgrade_id" ], "columnsTo": [ "id" ], - "onDelete": "cascade", - "onUpdate": "cascade" + "onDelete": "no action", + "onUpdate": "no action" } }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} + "compositePrimaryKeys": { + "upgrade_required_items_upgrade_id_item_id_pk": { + "name": "upgrade_required_items_upgrade_id_item_id_pk", + "columns": [ + "upgrade_id", + "item_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {}, + "policies": {}, + "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, "_meta": { - "columns": {}, "schemas": {}, - "tables": {} + "tables": {}, + "columns": {} + }, + "internal": { + "tables": { + "characters": { + "columns": { + "description": { + "isArray": true, + "dimensions": 1, + "rawType": "text" + } + } + }, + "gamestate": { + "columns": { + "researched": { + "isArray": true, + "dimensions": 1, + "rawType": "integer" + }, + "upgrades": { + "isArray": true, + "dimensions": 1, + "rawType": "json" + }, + "items": { + "isArray": true, + "dimensions": 1, + "rawType": "json" + } + } + } + } } } \ No newline at end of file diff --git a/src/db/migrations/meta/_journal.json b/src/db/migrations/meta/_journal.json index ad564e0..df11d3c 100644 --- a/src/db/migrations/meta/_journal.json +++ b/src/db/migrations/meta/_journal.json @@ -5,22 +5,8 @@ { "idx": 0, "version": "7", - "when": 1724336459981, - "tag": "0000_panoramic_santa_claus", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1724416077879, - "tag": "0001_slow_greymalkin", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1724677440465, - "tag": "0002_hesitant_lester", + "when": 1730308194751, + "tag": "20241030170954_petite_whistler", "breakpoints": true } ] diff --git a/src/db/migrations/relations.ts b/src/db/migrations/relations.ts old mode 100755 new mode 100644 index f3e35e0..b2e8324 --- a/src/db/migrations/relations.ts +++ b/src/db/migrations/relations.ts @@ -1,16 +1,94 @@ import { relations } from "drizzle-orm/relations"; -import { shopItems, upgrades, levels, cities, characters, elements, itemsRequiredResearch, research, researchRequiredResearch, upgradeRequiredResearch, itemsRequiredItems, researchRequiredItems, upgradeRequiredItems } from "./schema"; +import { cities, characters, elements, upgrades, levels, messages, users, usersInAuth, tilezGames, todos, shopItems, hashtags, hashtagMessages, userFollows, itemsRequiredResearch, research, likes, researchRequiredResearch, upgradeRequiredResearch, itemsRequiredItems, researchRequiredItems, upgradeRequiredItems } from "./schema"; + +export const charactersRelations = relations(characters, ({one}) => ({ + city: one(cities, { + fields: [characters.cityId], + references: [cities.id] + }), + element: one(elements, { + fields: [characters.elementId], + references: [elements.id] + }), +})); + +export const citiesRelations = relations(cities, ({many}) => ({ + characters: many(characters), +})); + +export const elementsRelations = relations(elements, ({many}) => ({ + characters: many(characters), +})); + +export const levelsRelations = relations(levels, ({one}) => ({ + upgrade: one(upgrades, { + fields: [levels.upgradeId], + references: [upgrades.id] + }), +})); export const upgradesRelations = relations(upgrades, ({one, many}) => ({ + levels: many(levels), shopItem: one(shopItems, { fields: [upgrades.effectItemId], references: [shopItems.id] }), - levels: many(levels), upgradeRequiredResearches: many(upgradeRequiredResearch), upgradeRequiredItems: many(upgradeRequiredItems), })); +export const messagesRelations = relations(messages, ({one, many}) => ({ + message: one(messages, { + fields: [messages.parentId], + references: [messages.id], + relationName: "messages_parentId_messages_id" + }), + messages: many(messages, { + relationName: "messages_parentId_messages_id" + }), + user: one(users, { + fields: [messages.userId], + references: [users.id] + }), + hashtagMessages: many(hashtagMessages), + likes: many(likes), +})); + +export const usersRelations = relations(users, ({one, many}) => ({ + messages: many(messages), + usersInAuth: one(usersInAuth, { + fields: [users.userId], + references: [usersInAuth.id] + }), + userFollows_followingUserId: many(userFollows, { + relationName: "userFollows_followingUserId_users_id" + }), + userFollows_userId: many(userFollows, { + relationName: "userFollows_userId_users_id" + }), + likes: many(likes), +})); + +export const tilezGamesRelations = relations(tilezGames, ({one}) => ({ + usersInAuth: one(usersInAuth, { + fields: [tilezGames.userId], + references: [usersInAuth.id] + }), +})); + +export const usersInAuthRelations = relations(usersInAuth, ({many}) => ({ + tilezGames: many(tilezGames), + todos: many(todos), + users: many(users), +})); + +export const todosRelations = relations(todos, ({one}) => ({ + usersInAuth: one(usersInAuth, { + fields: [todos.userId], + references: [usersInAuth.id] + }), +})); + export const shopItemsRelations = relations(shopItems, ({many}) => ({ upgrades: many(upgrades), itemsRequiredResearches: many(itemsRequiredResearch), @@ -24,30 +102,32 @@ export const shopItemsRelations = relations(shopItems, ({many}) => ({ upgradeRequiredItems: many(upgradeRequiredItems), })); -export const levelsRelations = relations(levels, ({one}) => ({ - upgrade: one(upgrades, { - fields: [levels.upgradeId], - references: [upgrades.id] +export const hashtagMessagesRelations = relations(hashtagMessages, ({one}) => ({ + hashtag: one(hashtags, { + fields: [hashtagMessages.hashtagId], + references: [hashtags.id] }), -})); - -export const charactersRelations = relations(characters, ({one}) => ({ - city: one(cities, { - fields: [characters.cityId], - references: [cities.id] - }), - element: one(elements, { - fields: [characters.elementId], - references: [elements.id] + message: one(messages, { + fields: [hashtagMessages.messageId], + references: [messages.id] }), })); -export const citiesRelations = relations(cities, ({many}) => ({ - characters: many(characters), +export const hashtagsRelations = relations(hashtags, ({many}) => ({ + hashtagMessages: many(hashtagMessages), })); -export const elementsRelations = relations(elements, ({many}) => ({ - characters: many(characters), +export const userFollowsRelations = relations(userFollows, ({one}) => ({ + user_followingUserId: one(users, { + fields: [userFollows.followingUserId], + references: [users.id], + relationName: "userFollows_followingUserId_users_id" + }), + user_userId: one(users, { + fields: [userFollows.userId], + references: [users.id], + relationName: "userFollows_userId_users_id" + }), })); export const itemsRequiredResearchRelations = relations(itemsRequiredResearch, ({one}) => ({ @@ -73,6 +153,17 @@ export const researchRelations = relations(research, ({many}) => ({ researchRequiredItems: many(researchRequiredItems), })); +export const likesRelations = relations(likes, ({one}) => ({ + message: one(messages, { + fields: [likes.messageId], + references: [messages.id] + }), + user: one(users, { + fields: [likes.userId], + references: [users.id] + }), +})); + export const researchRequiredResearchRelations = relations(researchRequiredResearch, ({one}) => ({ research_requiredId: one(research, { fields: [researchRequiredResearch.requiredId], diff --git a/src/db/migrations/rls.sql b/src/db/migrations/rls.sql deleted file mode 100644 index 8d3b7a7..0000000 --- a/src/db/migrations/rls.sql +++ /dev/null @@ -1,79 +0,0 @@ -ALTER TABLE "tilez_games" enable row level security; -DO $$ BEGIN -CREATE POLICY "tilez_select_policy" ON "tilez_games" FOR SELECT USING ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "tilez_insert_policy" ON "tilez_games" FOR INSERT TO "authenticated" WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "tilez_update_policy" ON "tilez_games" FOR UPDATE USING ( (SELECT auth.uid()) = user_id ) WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "tilez_delete_policy" ON "tilez_games" FOR DELETE TO "authenticated" USING ( (SELECT auth.uid()) = user_id ); -EXCEPTION - WHEN duplicate_object THEN null; - END $$;--> statement-breakpoint - - ALTER TABLE "todos" enable row level security; -DO $$ BEGIN -CREATE POLICY "todos_select_policy" ON "todos" FOR SELECT USING ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "todos_insert_policy" ON "todos" FOR INSERT TO "authenticated" WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "todos_update_policy" ON "todos" FOR UPDATE USING ( (SELECT auth.uid()) = user_id ) WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "todos_delete_policy" ON "todos" FOR DELETE TO "authenticated" USING ( (SELECT auth.uid()) = user_id ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER TABLE "users" enable row level security; -DO $$ BEGIN -CREATE POLICY "users_select_policy" ON "users" FOR SELECT USING ( true ); -CREATE POLICY "users_insert_policy" ON "users" FOR INSERT TO "authenticated" WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "users_update_policy" ON "users" FOR UPDATE USING ( (SELECT auth.uid()) = user_id ) WITH CHECK ( (SELECT auth.uid()) = user_id ); -CREATE POLICY "users_delete_policy" ON "users" FOR DELETE TO "authenticated" USING ( (SELECT auth.uid()) = user_id ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER Table "messages" enable row level security; -DO $$ BEGIN -CREATE POLICY "messages_select_policy" ON "messages" FOR SELECT USING ( true ); -CREATE POLICY "messages_insert_policy" ON "messages" FOR INSERT TO "authenticated" WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "messages_update_policy" ON "messages" FOR UPDATE USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ) WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "messages_delete_policy" ON "messages" FOR DELETE TO "authenticated" USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER Table "likes" enable row level security; -DO $$ BEGIN -CREATE POLICY "likes_select_policy" ON "likes" FOR SELECT USING ( true ); -CREATE POLICY "likes_insert_policy" ON "likes" FOR INSERT TO "authenticated" WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "likes_update_policy" ON "likes" FOR UPDATE USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ) WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "likes_delete_policy" ON "likes" FOR DELETE TO "authenticated" USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER Table "user_follows" enable row level security; -DO $$ BEGIN -CREATE POLICY "user_follows_select_policy" ON "user_follows" FOR SELECT USING ( true ); -CREATE POLICY "user_follows_insert_policy" ON "user_follows" FOR INSERT TO "authenticated" WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "user_follows_update_policy" ON "user_follows" FOR UPDATE USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ) WITH CHECK ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -CREATE POLICY "user_follows_delete_policy" ON "user_follows" FOR DELETE TO "authenticated" USING ( (user_id IN (SELECT id FROM users WHERE users.user_id = auth.uid())) ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER Table "hashtag_messages" enable row level security; -DO $$ BEGIN -CREATE POLICY "hashtag_messages_select_policy" ON "hashtag_messages" FOR SELECT USING ( true ); -CREATE POLICY "hashtag_messages_insert_policy" ON "hashtag_messages" FOR INSERT TO "appuser" WITH CHECK ( true ); -CREATE POLICY "hashtag_messages_update_policy" ON "hashtag_messages" FOR UPDATE TO "appuser" USING ( true ); -CREATE POLICY "hashtag_messages_delete_policy" ON "hashtag_messages" FOR DELETE TO "appuser" USING ( true ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint - -ALTER Table "hashtags" enable row level security; -DO $$ BEGIN -CREATE POLICY "hashtags_select_policy" ON "hashtags" FOR SELECT USING ( true ); -CREATE POLICY "hashtags_insert_policy" ON "hashtags" FOR INSERT TO "appuser" WITH CHECK ( true ); -CREATE POLICY "hashtags_update_policy" ON "hashtags" FOR UPDATE TO "appuser" USING ( true ); -CREATE POLICY "hashtags_delete_policy" ON "hashtags" FOR DELETE TO "appuser" USING ( true ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$;--> statement-breakpoint \ No newline at end of file diff --git a/src/db/migrations/schema.ts b/src/db/migrations/schema.ts old mode 100755 new mode 100644 index 539b602..104f9e5 --- a/src/db/migrations/schema.ts +++ b/src/db/migrations/schema.ts @@ -1,330 +1,448 @@ -import { sql } from "drizzle-orm"; +import { pgTable, foreignKey, unique, integer, text, bigint, real, json, index, pgPolicy, uuid, timestamp, boolean, uniqueIndex, char, primaryKey } from "drizzle-orm/pg-core" +import { sql } from "drizzle-orm" import { - pgTable, - integer, - text, - bigint, - real, - unique, - primaryKey, - json, - uuid, - boolean, - timestamp, - index, -} from "drizzle-orm/pg-core"; -import { users } from "../auth_schema"; + authenticatedRole, + authUid, + authUsers, + realtimeMessages, + realtimeTopic, + supabaseAuthAdminRole, + } from "drizzle-orm/supabase"; + + export const usersInAuth = authUsers + +export const characters = pgTable("characters", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "characters_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), + description: text().array().notNull(), + elementId: integer("element_id").notNull(), + cityId: integer("city_id").notNull(), +}, (table) => { + return { + charactersCityIdCitiesIdFk: foreignKey({ + columns: [table.cityId], + foreignColumns: [cities.id], + name: "characters_city_id_cities_id_fk" + }), + charactersElementIdElementsIdFk: foreignKey({ + columns: [table.elementId], + foreignColumns: [elements.id], + name: "characters_element_id_elements_id_fk" + }), + charactersNameUnique: unique("characters_name_unique").on(table.name), + } +}); + +export const cities = pgTable("cities", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "cities_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), +}, (table) => { + return { + citiesNameUnique: unique("cities_name_unique").on(table.name), + } +}); + +export const elements = pgTable("elements", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "elements_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), + colour: text().notNull(), +}, (table) => { + return { + elementsNameUnique: unique("elements_name_unique").on(table.name), + elementsColourUnique: unique("elements_colour_unique").on(table.colour), + } +}); export const gamestate = pgTable("gamestate", { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "gamestats_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - playername: text("playername").notNull(), - theme: text("theme").notNull(), - // You can use { mode: "bigint" } if numbers are exceeding js number limitations - currentscore: bigint("currentscore", { mode: "number" }).notNull(), - // You can use { mode: "bigint" } if numbers are exceeding js number limitations - totalclicks: bigint("totalclicks", { mode: "number" }).notNull(), - // You can use { mode: "bigint" } if numbers are exceeding js number limitations - totalspent: bigint("totalspent", { mode: "number" }).notNull(), - currentaveragecps: real("currentaveragecps").notNull(), - averageclickvalue: real("averageclickvalue").notNull(), - researched: integer("researched").array().notNull(), - // TODO: failed to parse database type 'json[]' - upgrades: json("upgrades").array().notNull(), - // TODO: failed to parse database type 'json[]' - items: json("items").array().notNull(), + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "gamestats_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + playername: text().notNull(), + theme: text().notNull(), + // You can use { mode: "bigint" } if numbers are exceeding js number limitations + currentscore: bigint({ mode: "number" }).notNull(), + // You can use { mode: "bigint" } if numbers are exceeding js number limitations + totalclicks: bigint({ mode: "number" }).notNull(), + // You can use { mode: "bigint" } if numbers are exceeding js number limitations + totalspent: bigint({ mode: "number" }).notNull(), + currentaveragecps: real().notNull(), + averageclickvalue: real().notNull(), + researched: integer().array().notNull(), + upgrades: json().array().notNull(), + items: json().array().notNull(), }); -export const shopItems = pgTable("shop_items", { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "shop_items_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - cost: integer("cost").notNull(), - maxQty: integer("maxQty").notNull(), - multiplier: real("multiplier").notNull(), - baseValue: real("baseValue").notNull(), - critChance: real("critChance").notNull(), - critDamage: real("critDamage").notNull(), +export const hashtags = pgTable("hashtags", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + hashtag: text().notNull(), +}, (table) => { + return { + hashtagIdx: index("hashtags_hashtag_idx").using("btree", table.hashtag.asc().nullsLast()), + hashtagsDeletePolicy: pgPolicy("hashtags_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`true` }), + hashtagsInsertPolicy: pgPolicy("hashtags_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + hashtagsSelectPolicy: pgPolicy("hashtags_select_policy", { as: "permissive", for: "select", to: ["public"] }), + hashtagsUpdatePolicy: pgPolicy("hashtags_update_policy", { as: "permissive", for: "update", to: ["authenticated"] }), + } +}); + +export const levels = pgTable("levels", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "levels_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + level: integer().notNull(), + upgradeId: integer("upgrade_id").notNull(), + cost: integer().notNull(), + baseValue: real().notNull(), + critChance: real().notNull(), + critDamage: real().notNull(), +}, (table) => { + return { + levelsUpgradeIdUpgradesIdFk: foreignKey({ + columns: [table.upgradeId], + foreignColumns: [upgrades.id], + name: "levels_upgrade_id_upgrades_id_fk" + }), + } +}); + +export const messages = pgTable("messages", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + userId: uuid("user_id").notNull(), + parentId: uuid("parent_id"), + message: text().notNull(), + createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), + updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }), +}, (table) => { + return { + parentIdIdx: index("messages_parent_id_idx").using("btree", table.parentId.asc().nullsLast()), + userIdIdx: index("messages_user_id_idx").using("btree", table.userId.asc().nullsLast()), + messagesParentIdMessagesIdFk: foreignKey({ + columns: [table.parentId], + foreignColumns: [table.id], + name: "messages_parent_id_messages_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + messagesUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [users.id], + name: "messages_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + messagesDeletePolicy: pgPolicy("messages_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid))))` }), + messagesInsertPolicy: pgPolicy("messages_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + messagesSelectPolicy: pgPolicy("messages_select_policy", { as: "permissive", for: "select", to: ["public"] }), + messagesUpdatePolicy: pgPolicy("messages_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } }); export const research = pgTable("research", { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "research_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - description: text("description").notNull(), - cost: integer("cost").notNull(), + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "research_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), + description: text().notNull(), + cost: integer().notNull(), }); -export const upgrades = pgTable("upgrades", { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "upgrades_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - description: text("description").notNull(), - effectItemId: integer("effectItemId") - .notNull() - .references(() => shopItems.id), +export const shopItems = pgTable("shop_items", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "shop_items_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), + cost: integer().notNull(), + maxQty: integer().notNull(), + multiplier: real().notNull(), + baseValue: real().notNull(), + critChance: real().notNull(), + critDamage: real().notNull(), }); -export const levels = pgTable("levels", { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "levels_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - level: integer("level").notNull(), - upgradeId: integer("upgrade_id") - .notNull() - .references(() => upgrades.id), - cost: integer("cost").notNull(), - baseValue: real("baseValue").notNull(), - critChance: real("critChance").notNull(), - critDamage: real("critDamage").notNull(), +export const tilezGames = pgTable("tilez_games", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + gameId: text("game_id").notNull(), + userId: uuid("user_id").notNull(), + gameStart: timestamp("game_start", { mode: 'string' }), + gameEnd: timestamp("game_end", { mode: 'string' }).defaultNow(), + numMoves: integer("num_moves").default(0), + completed: boolean().default(false), +}, (table) => { + return { + tilezGameIdIdx: index("tilez_game_id_idx").using("btree", table.gameId.asc().nullsLast()), + tilezGameUserIdIdx: index("tilez_game_user_id_idx").using("btree", table.userId.asc().nullsLast()), + tilezGamesUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [users.id], + name: "tilez_games_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + tilezDeletePolicy: pgPolicy("tilez_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(( SELECT auth.uid() AS uid) = user_id)` }), + tilezInsertPolicy: pgPolicy("tilez_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + tilezSelectPolicy: pgPolicy("tilez_select_policy", { as: "permissive", for: "select", to: ["public"] }), + tilezUpdatePolicy: pgPolicy("tilez_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } }); -export const elements = pgTable( - "elements", - { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "elements_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - colour: text("colour").notNull(), - }, - (table) => { - return { - elementsNameUnique: unique("elements_name_unique").on(table.name), - elementsColourUnique: unique("elements_colour_unique").on(table.colour), - }; - }, -); +export const tilezWords = pgTable("tilez_words", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + word: char({ length: 6 }).notNull(), + definition: text().notNull(), + lastChecked: timestamp("last_checked", { mode: 'string' }).notNull(), +}, (table) => { + return { + tilezWordWordIdx: uniqueIndex("tilez_word_word_idx").using("btree", table.word.asc().nullsLast()), + } +}); -export const characters = pgTable( - "characters", - { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "characters_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - description: text("description").array().notNull(), - elementId: integer("element_id") - .notNull() - .references(() => elements.id), - cityId: integer("city_id") - .notNull() - .references(() => cities.id), - }, - (table) => { - return { - charactersNameUnique: unique("characters_name_unique").on(table.name), - }; - }, -); +export const todos = pgTable("todos", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + title: text().notNull(), + completed: boolean().default(false).notNull(), + userId: uuid("user_id").notNull(), + createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), +}, (table) => { + return { + userIdIdx: index("todos_user_id_idx").using("btree", table.userId.asc().nullsLast()), + todosUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [users.id], + name: "todos_user_id_users_id_fk" + }), + todosDeletePolicy: pgPolicy("todos_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(( SELECT auth.uid() AS uid) = user_id)` }), + todosInsertPolicy: pgPolicy("todos_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + todosSelectPolicy: pgPolicy("todos_select_policy", { as: "permissive", for: "select", to: ["public"] }), + todosUpdatePolicy: pgPolicy("todos_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } +}); + +export const upgrades = pgTable("upgrades", { + id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "upgrades_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }), + name: text().notNull(), + description: text().notNull(), + effectItemId: integer().notNull(), +}, (table) => { + return { + upgradesEffectItemIdShopItemsIdFk: foreignKey({ + columns: [table.effectItemId], + foreignColumns: [shopItems.id], + name: "upgrades_effectItemId_shop_items_id_fk" + }), + } +}); + +export const users = pgTable("users", { + id: uuid().default(sql`uuid_generate_v4()`).primaryKey().notNull(), + userId: uuid("user_id"), + username: text().notNull(), + email: text().notNull(), + createdAt: timestamp("created_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), + updatedAt: timestamp("updated_at", { withTimezone: true, mode: 'string' }), + bio: text(), + avatar: text(), +}, (table) => { + return { + emailIdx: index("users_email_idx").using("btree", table.email.asc().nullsLast()), + userIdIdx: index("users_user_id_idx").using("btree", table.userId.asc().nullsLast()), + usernameIdx: index("users_username_idx").using("btree", table.username.asc().nullsLast()), + usersUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [table.id], + name: "users_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + usersDeletePolicy: pgPolicy("users_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(( SELECT auth.uid() AS uid) = user_id)` }), + usersInsertPolicy: pgPolicy("users_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + usersSelectPolicy: pgPolicy("users_select_policy", { as: "permissive", for: "select", to: ["public"] }), + usersUpdatePolicy: pgPolicy("users_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } +}); + +export const hashtagMessages = pgTable("hashtag_messages", { + hashtagId: uuid("hashtag_id").notNull(), + messageId: uuid("message_id").notNull(), +}, (table) => { + return { + hashtagIdIdx: index("hashtag_messages_hashtag_id_idx").using("btree", table.hashtagId.asc().nullsLast()), + messageIdIdx: index("hashtag_messages_message_id_idx").using("btree", table.messageId.asc().nullsLast()), + hashtagMessagesHashtagIdHashtagsIdFk: foreignKey({ + columns: [table.hashtagId], + foreignColumns: [hashtags.id], + name: "hashtag_messages_hashtag_id_hashtags_id_fk" + }).onUpdate("cascade").onDelete("restrict"), + hashtagMessagesMessageIdMessagesIdFk: foreignKey({ + columns: [table.messageId], + foreignColumns: [messages.id], + name: "hashtag_messages_message_id_messages_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + hashtagMessagesPk: primaryKey({ columns: [table.hashtagId, table.messageId], name: "hashtag_messages_pk"}), + hashtagMessagesDeletePolicy: pgPolicy("hashtag_messages_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`true` }), + hashtagMessagesInsertPolicy: pgPolicy("hashtag_messages_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + hashtagMessagesSelectPolicy: pgPolicy("hashtag_messages_select_policy", { as: "permissive", for: "select", to: ["public"] }), + hashtagMessagesUpdatePolicy: pgPolicy("hashtag_messages_update_policy", { as: "permissive", for: "update", to: ["authenticated"] }), + } +}); -export const cities = pgTable( - "cities", - { - id: integer("id").primaryKey().generatedAlwaysAsIdentity({ - name: "cities_id_seq", - startWith: 1, - increment: 1, - minValue: 1, - maxValue: 2147483647, - cache: 1, - }), - name: text("name").notNull(), - }, - (table) => { - return { - citiesNameUnique: unique("cities_name_unique").on(table.name), - }; - }, -); +export const userFollows = pgTable("user_follows", { + userId: uuid("user_id").notNull(), + followingUserId: uuid("following_user_id").notNull(), +}, (table) => { + return { + followingUserIdIdx: index("user_follows_following_user_id_idx").using("btree", table.followingUserId.asc().nullsLast()), + userIdIdx: index("user_follows_user_id_idx").using("btree", table.userId.asc().nullsLast()), + userFollowsFollowingUserIdUsersIdFk: foreignKey({ + columns: [table.followingUserId], + foreignColumns: [users.id], + name: "user_follows_following_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + userFollowsUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [users.id], + name: "user_follows_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + userFollowsPk: primaryKey({ columns: [table.userId, table.followingUserId], name: "user_follows_pk"}), + userFollowsDeletePolicy: pgPolicy("user_follows_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid))))` }), + userFollowsInsertPolicy: pgPolicy("user_follows_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + userFollowsSelectPolicy: pgPolicy("user_follows_select_policy", { as: "permissive", for: "select", to: ["public"] }), + userFollowsUpdatePolicy: pgPolicy("user_follows_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } +}); -export const itemsRequiredResearch = pgTable( - "items_required_research", - { - itemId: integer("item_id") - .notNull() - .references(() => shopItems.id), - requiredId: integer("required_id") - .notNull() - .references(() => research.id), - description: text("description").notNull(), - }, - (table) => { - return { - itemsRequiredResearchItemIdRequiredIdPk: primaryKey({ - columns: [table.itemId, table.requiredId], - name: "items_required_research_item_id_required_id_pk", - }), - }; - }, -); +export const itemsRequiredResearch = pgTable("items_required_research", { + itemId: integer("item_id").notNull(), + requiredId: integer("required_id").notNull(), + description: text().notNull(), +}, (table) => { + return { + itemsRequiredResearchItemIdShopItemsIdFk: foreignKey({ + columns: [table.itemId], + foreignColumns: [shopItems.id], + name: "items_required_research_item_id_shop_items_id_fk" + }), + itemsRequiredResearchRequiredIdResearchIdFk: foreignKey({ + columns: [table.requiredId], + foreignColumns: [research.id], + name: "items_required_research_required_id_research_id_fk" + }), + itemsRequiredResearchItemIdRequiredIdPk: primaryKey({ columns: [table.itemId, table.requiredId], name: "items_required_research_item_id_required_id_pk"}), + } +}); -export const researchRequiredResearch = pgTable( - "research_required_research", - { - researchId: integer("research_id") - .notNull() - .references(() => research.id), - requiredId: integer("required_id") - .notNull() - .references(() => research.id), - description: text("description").notNull(), - }, - (table) => { - return { - researchRequiredResearchResearchIdRequiredIdPk: primaryKey({ - columns: [table.researchId, table.requiredId], - name: "research_required_research_research_id_required_id_pk", - }), - }; - }, -); +export const likes = pgTable("likes", { + userId: uuid("user_id").notNull(), + messageId: uuid("message_id").notNull(), + like: integer().default(0).notNull(), +}, (table) => { + return { + likesMessageIdMessagesIdFk: foreignKey({ + columns: [table.messageId], + foreignColumns: [messages.id], + name: "likes_message_id_messages_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + likesUserIdUsersIdFk: foreignKey({ + columns: [table.userId], + foreignColumns: [users.id], + name: "likes_user_id_users_id_fk" + }).onUpdate("cascade").onDelete("cascade"), + likesPk: primaryKey({ columns: [table.userId, table.messageId], name: "likes_pk"}), + likesDeletePolicy: pgPolicy("likes_delete_policy", { as: "permissive", for: "delete", to: ["authenticated"], using: sql`(user_id IN ( SELECT users.id + FROM users + WHERE (users.user_id = ( SELECT auth.uid() AS uid))))` }), + likesInsertPolicy: pgPolicy("likes_insert_policy", { as: "permissive", for: "insert", to: ["authenticated"] }), + likesSelectPolicy: pgPolicy("likes_select_policy", { as: "permissive", for: "select", to: ["public"] }), + likesUpdatePolicy: pgPolicy("likes_update_policy", { as: "permissive", for: "update", to: ["public"] }), + } +}); -export const upgradeRequiredResearch = pgTable( - "upgrade_required_research", - { - upgradeId: integer("upgrade_id") - .notNull() - .references(() => upgrades.id), - requiredId: integer("required_id") - .notNull() - .references(() => research.id), - description: text("description").notNull(), - }, - (table) => { - return { - upgradeRequiredResearchPkey: primaryKey({ - columns: [table.upgradeId, table.requiredId], - name: "upgrade_required_research_pkey", - }), - }; - }, -); +export const researchRequiredResearch = pgTable("research_required_research", { + researchId: integer("research_id").notNull(), + requiredId: integer("required_id").notNull(), + description: text().notNull(), +}, (table) => { + return { + researchRequiredResearchRequiredIdResearchIdFk: foreignKey({ + columns: [table.requiredId], + foreignColumns: [research.id], + name: "research_required_research_required_id_research_id_fk" + }), + researchRequiredResearchResearchIdResearchIdFk: foreignKey({ + columns: [table.researchId], + foreignColumns: [research.id], + name: "research_required_research_research_id_research_id_fk" + }), + researchRequiredResearchResearchIdRequiredIdPk: primaryKey({ columns: [table.researchId, table.requiredId], name: "research_required_research_research_id_required_id_pk"}), + } +}); -export const itemsRequiredItems = pgTable( - "items_required_items", - { - itemId: integer("item_id") - .notNull() - .references(() => shopItems.id), - requiredId: integer("required_id") - .notNull() - .references(() => shopItems.id), - quantity: integer("quantity").notNull(), - description: text("description").notNull(), - }, - (table) => { - return { - itemsRequiredItemsItemIdRequiredIdPk: primaryKey({ - columns: [table.itemId, table.requiredId], - name: "items_required_items_item_id_required_id_pk", - }), - }; - }, -); +export const upgradeRequiredResearch = pgTable("upgrade_required_research", { + upgradeId: integer("upgrade_id").notNull(), + requiredId: integer("required_id").notNull(), + description: text().notNull(), +}, (table) => { + return { + upgradeRequiredResearchRequiredIdResearchIdFk: foreignKey({ + columns: [table.requiredId], + foreignColumns: [research.id], + name: "upgrade_required_research_required_id_research_id_fk" + }), + upgradeRequiredResearchUpgradeIdUpgradesIdFk: foreignKey({ + columns: [table.upgradeId], + foreignColumns: [upgrades.id], + name: "upgrade_required_research_upgrade_id_upgrades_id_fk" + }), + upgradeRequiredResearchUpgradeIdResearchIdPk: primaryKey({ columns: [table.upgradeId, table.requiredId], name: "upgrade_required_research_upgrade_id_research_id_pk"}), + } +}); -export const researchRequiredItems = pgTable( - "research_required_items", - { - researchId: integer("research_id") - .notNull() - .references(() => research.id), - itemId: integer("item_id") - .notNull() - .references(() => shopItems.id), - quantity: integer("quantity").notNull(), - description: text("description").notNull(), - }, - (table) => { - return { - researchRequiredItemsResearchIdItemIdPk: primaryKey({ - columns: [table.researchId, table.itemId], - name: "research_required_items_research_id_item_id_pk", - }), - }; - }, -); +export const itemsRequiredItems = pgTable("items_required_items", { + itemId: integer("item_id").notNull(), + requiredId: integer("required_id").notNull(), + quantity: integer().notNull(), + description: text().notNull(), +}, (table) => { + return { + itemsRequiredItemsItemIdShopItemsIdFk: foreignKey({ + columns: [table.itemId], + foreignColumns: [shopItems.id], + name: "items_required_items_item_id_shop_items_id_fk" + }), + itemsRequiredItemsRequiredIdShopItemsIdFk: foreignKey({ + columns: [table.requiredId], + foreignColumns: [shopItems.id], + name: "items_required_items_required_id_shop_items_id_fk" + }), + itemsRequiredItemsItemIdRequiredIdPk: primaryKey({ columns: [table.itemId, table.requiredId], name: "items_required_items_item_id_required_id_pk"}), + } +}); -export const upgradeRequiredItems = pgTable( - "upgrade_required_items", - { - upgradeId: integer("upgrade_id") - .notNull() - .references(() => upgrades.id), - itemId: integer("item_id") - .notNull() - .references(() => shopItems.id), - quantity: integer("quantity").notNull(), - description: text("description").notNull(), - }, - (table) => { - return { - upgradeRequiredItemsUpgradeIdItemIdPk: primaryKey({ - columns: [table.upgradeId, table.itemId], - name: "upgrade_required_items_upgrade_id_item_id_pk", - }), - }; - }, -); +export const researchRequiredItems = pgTable("research_required_items", { + researchId: integer("research_id").notNull(), + itemId: integer("item_id").notNull(), + quantity: integer().notNull(), + description: text().notNull(), +}, (table) => { + return { + researchRequiredItemsItemIdShopItemsIdFk: foreignKey({ + columns: [table.itemId], + foreignColumns: [shopItems.id], + name: "research_required_items_item_id_shop_items_id_fk" + }), + researchRequiredItemsResearchIdResearchIdFk: foreignKey({ + columns: [table.researchId], + foreignColumns: [research.id], + name: "research_required_items_research_id_research_id_fk" + }), + researchRequiredItemsResearchIdItemIdPk: primaryKey({ columns: [table.researchId, table.itemId], name: "research_required_items_research_id_item_id_pk"}), + } +}); -export const todos = pgTable( - "todos", - { - id: uuid("id") - .default(sql`uuid_generate_v4()`) - .primaryKey() - .notNull(), - title: text("title").notNull(), - completed: boolean("completed").notNull().default(false), - userId: uuid("user_id") - .notNull() - .references(() => users.id), - createdAt: timestamp("created_at", { withTimezone: true }) - .notNull() - .default(sql`now()`), - }, - (table) => { - return { - userIdx: index("todos_user_id_idx").using("btree", table.userId), - }; - }, -); +export const upgradeRequiredItems = pgTable("upgrade_required_items", { + upgradeId: integer("upgrade_id").notNull(), + itemId: integer("item_id").notNull(), + quantity: integer().notNull(), + description: text().notNull(), +}, (table) => { + return { + upgradeRequiredItemsItemIdShopItemsIdFk: foreignKey({ + columns: [table.itemId], + foreignColumns: [shopItems.id], + name: "upgrade_required_items_item_id_shop_items_id_fk" + }), + upgradeRequiredItemsUpgradeIdUpgradesIdFk: foreignKey({ + columns: [table.upgradeId], + foreignColumns: [upgrades.id], + name: "upgrade_required_items_upgrade_id_upgrades_id_fk" + }), + upgradeRequiredItemsUpgradeIdItemIdPk: primaryKey({ columns: [table.upgradeId, table.itemId], name: "upgrade_required_items_upgrade_id_item_id_pk"}), + } +}); diff --git a/src/db/tilez/db.ts b/src/db/tilez/db.ts index fb9fd15..f984740 100644 --- a/src/db/tilez/db.ts +++ b/src/db/tilez/db.ts @@ -1,44 +1,61 @@ import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import * as schema from "./schema"; -import { JWTPayload } from "jose"; import { sql } from "drizzle-orm"; +import { JWTPayload } from "jose"; + +type SupabaseToken = { + role?: string; +} & JWTPayload; const connectionString = process.env.DATABASE_AUTH_URL!; -const client = postgres(connectionString, { - prepare: false, - connect_timeout: 60, - idle_timeout: 10, +const db = drizzle({ + client: postgres(connectionString, { + prepare: false, + connect_timeout: 60, + idle_timeout: 10, + }), + schema, }); -const db = drizzle(client, { schema }); -export const getdb = (decodedJwt?: JWTPayload) => { - return new Proxy(db, { - get(target, prop) { - if (prop === "transaction" && decodedJwt) { - return (async (transaction, ...rest) => { - return await target.transaction( - async (tx) => { - await tx.execute(sql` - select set_config('request.jwt.claims', '${sql.raw( - JSON.stringify(decodedJwt), - )}', TRUE); - select set_config('request.jwt.claim.sub', '${sql.raw( - decodedJwt.sub ?? "", - )}', TRUE); - select set_config('request.jwt.claim.email', '${sql.raw( - decodedJwt.email as string, - )}', TRUE); - select set_config('request.jwt.claim.role', '${sql.raw( - decodedJwt.role as string, - )}', TRUE); - set local role ${sql.raw(decodedJwt.role as string)}; - `); - return await transaction(tx); - }, - ...rest, - ); - }) as typeof db.transaction; - } else return target[prop as keyof typeof db]; - }, - }); -}; +export function dbClient( + token?: Token, +) { + if (!token) { + return { + db, + rls: {} as typeof db.transaction, + }; + } + return { + db, + rls: (async (transaction, ...rest) => { + return await db.transaction( + async (tx) => { + try { + await tx.execute(sql` + -- auth.jwt() + select set_config('request.jwt.claims', '${sql.raw( + JSON.stringify(token), + )}', TRUE); + -- auth.uid() + select set_config('request.jwt.claim.sub', '${sql.raw( + token.sub ?? "", + )}', TRUE); + -- set local role + set local role ${sql.raw(token.role ?? "anon")}; + `); + return await transaction(tx); + } finally { + await tx.execute(sql` + -- reset + select set_config('request.jwt.claims', NULL, TRUE); + select set_config('request.jwt.claim.sub', NULL, TRUE); + reset role; + `); + } + }, + ...rest, + ); + }) as typeof db.transaction, + }; +} diff --git a/src/db/tilez/schema.ts b/src/db/tilez/schema.ts index 7cdc637..7a80468 100644 --- a/src/db/tilez/schema.ts +++ b/src/db/tilez/schema.ts @@ -7,11 +7,16 @@ import { boolean, index, uniqueIndex, - varchar, char, + pgPolicy, } from "drizzle-orm/pg-core"; -import { sql } from "drizzle-orm"; -import { users } from "../auth_schema"; +import { eq, sql } from "drizzle-orm"; +import { + authUsers, + authenticatedRole, + authUid, + postgresRole, +} from "drizzle-orm/supabase"; export const tilez_games = pgTable( "tilez_games", @@ -23,7 +28,7 @@ export const tilez_games = pgTable( game_id: text("game_id").notNull(), userId: uuid("user_id") .notNull() - .references(() => users.id, { + .references(() => authUsers.id, { onDelete: "cascade", onUpdate: "cascade", }), @@ -32,12 +37,35 @@ export const tilez_games = pgTable( num_moves: integer("num_moves").default(0), completed: boolean("completed").default(false), }, - (table) => { - return { - game_id_idx: index("tilez_game_id_idx").using("btree", table.game_id), - user_id_idx: index("tilez_game_user_id_idx").using("btree", table.userId), - }; - }, + (table) => [ + index("tilez_game_id_idx").using("btree", table.game_id), + index("tilez_game_user_id_idx").using("btree", table.userId), + pgPolicy("tilez_delete_policy", { + as: "permissive", + for: "delete", + to: authenticatedRole, + using: eq(table.userId, authUid), + }), + pgPolicy("tilez_insert_policy", { + as: "permissive", + for: "insert", + to: authenticatedRole, + withCheck: eq(table.userId, authUid), + }), + pgPolicy("tilez_select_policy", { + as: "permissive", + for: "select", + to: authenticatedRole, + using: eq(table.userId, authUid), + }), + pgPolicy("tilez_update_policy", { + as: "permissive", + for: "update", + to: authenticatedRole, + withCheck: eq(table.userId, authUid), + using: eq(table.userId, authUid), + }), + ], ); export const tilez_words = pgTable( @@ -51,9 +79,27 @@ export const tilez_words = pgTable( definition: text("definition").notNull(), last_checked: timestamp("last_checked", { mode: "string" }).notNull(), }, - (table) => { - return { - word_idx: uniqueIndex("tilez_word_word_idx").using("btree", table.word), - }; - }, + (table) => [ + uniqueIndex("tilez_word_word_idx").using("btree", table.word), + pgPolicy("tilez_delete_word_policy", { + as: "permissive", + for: "delete", + to: postgresRole, + }), + pgPolicy("tilez_insert_word_policy", { + as: "permissive", + for: "insert", + to: postgresRole, + }), + pgPolicy("tilez_select_word_policy", { + as: "permissive", + for: "select", + to: postgresRole, + }), + pgPolicy("tilez_update_word_policy", { + as: "permissive", + for: "update", + to: postgresRole, + }), + ], ); diff --git a/src/db/todos/db.ts b/src/db/todos/db.ts index 8645309..e0403ed 100644 --- a/src/db/todos/db.ts +++ b/src/db/todos/db.ts @@ -1,44 +1,52 @@ import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import * as schema from "./schema"; -import { JWTPayload } from "jose"; import { sql } from "drizzle-orm"; +import { JWTPayload } from "jose"; + +type SupabaseToken = { + role?: string; +} & JWTPayload; const connectionString = process.env.DATABASE_AUTH_URL!; -const client = postgres(connectionString, { - prepare: false, - connect_timeout: 60, - idle_timeout: 10, +const db = drizzle({ + client: postgres(connectionString, { + prepare: false, + connect_timeout: 60, + idle_timeout: 10, + }), + schema, }); -const db = drizzle(client, { schema }); -export const getdb = (decodedJwt: JWTPayload) => { - return new Proxy(db, { - get(target, prop) { - if (prop === "transaction") { - return (async (transaction, ...rest) => { - return await target.transaction( - async (tx) => { - await tx.execute(sql` - select set_config('request.jwt.claims', '${sql.raw( - JSON.stringify(decodedJwt), - )}', TRUE); - select set_config('request.jwt.claim.sub', '${sql.raw( - decodedJwt.sub ?? "", - )}', TRUE); - select set_config('request.jwt.claim.email', '${sql.raw( - decodedJwt.email as string, - )}', TRUE); - select set_config('request.jwt.claim.role', '${sql.raw( - decodedJwt.role as string, - )}', TRUE); - set local role ${sql.raw(decodedJwt.role as string)}; - `); - return await transaction(tx); - }, - ...rest, - ); - }) as typeof db.transaction; - } - }, - }); -}; +export function dbClient< + Token extends SupabaseToken = SupabaseToken, +>(token: Token) { + return { + db, + rls: (async (transaction, ...rest) => { + return await db.transaction(async (tx) => { + try { + await tx.execute(sql` + -- auth.jwt() + select set_config('request.jwt.claims', '${sql.raw( + JSON.stringify(token), + )}', TRUE); + -- auth.uid() + select set_config('request.jwt.claim.sub', '${sql.raw( + token.sub ?? "", + )}', TRUE); + -- set local role + set local role ${sql.raw(token.role ?? "anon")}; + `); + return await transaction(tx); + } finally { + await tx.execute(sql` + -- reset + select set_config('request.jwt.claims', NULL, TRUE); + select set_config('request.jwt.claim.sub', NULL, TRUE); + reset role; + `); + } + }, ...rest); + }) as typeof db.transaction, + } +} diff --git a/src/db/todos/schema.ts b/src/db/todos/schema.ts index 8a11f0e..f4dc1a1 100644 --- a/src/db/todos/schema.ts +++ b/src/db/todos/schema.ts @@ -1,9 +1,18 @@ -import { sql } from "drizzle-orm"; -import { boolean, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"; -import { users } from "../auth_schema"; +import { eq, sql } from "drizzle-orm"; +import { + boolean, + index, + pgPolicy, + pgTable, + text, + timestamp, + uuid, +} from "drizzle-orm/pg-core"; +import { authUsers, authenticatedRole, authUid } from "drizzle-orm/supabase"; - -export const todos = pgTable("todos", { +export const todos = pgTable( + "todos", + { id: uuid("id") .default(sql`uuid_generate_v4()`) .primaryKey() @@ -12,8 +21,37 @@ export const todos = pgTable("todos", { completed: boolean("completed").notNull().default(false), userId: uuid("user_id") .notNull() - .references(() => users.id), + .references(() => authUsers.id), createdAt: timestamp("created_at", { withTimezone: true }) .notNull() .default(sql`now()`), - }); \ No newline at end of file + }, + (table) => [ + pgPolicy("todos_delete_policy", { + as: "permissive", + for: "delete", + to: authenticatedRole, + using: eq(table.userId, authUid), + }), + pgPolicy("todos_insert_policy", { + as: "permissive", + for: "insert", + to: authenticatedRole, + withCheck: eq(table.userId, authUid), + }), + pgPolicy("todos_select_policy", { + as: "permissive", + for: "select", + to: authenticatedRole, + using: eq(table.userId, authUid), + }), + pgPolicy("todos_update_policy", { + as: "permissive", + for: "update", + to: authenticatedRole, + withCheck: eq(table.userId, authUid), + using: eq(table.userId, authUid), + }), + index("todos_user_id_idx").using("btree", table.userId), + ], +); diff --git a/yarn.lock b/yarn.lock index d9e6505..9b9e980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,56 @@ __metadata: version: 8 cacheKey: 10c0 +"@ampproject/remapping@npm:^2.2.0": + version: 2.3.0 + resolution: "@ampproject/remapping@npm:2.3.0" + dependencies: + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/81d63cca5443e0f0c72ae18b544cc28c7c0ec2cea46e7cb888bb0e0f411a1191d0d6b7af798d54e30777d8d1488b2ec0732aac2be342d3d7d3ffd271c6f489ed + languageName: node + linkType: hard + +"@babel/code-frame@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/code-frame@npm:7.25.7" + dependencies: + "@babel/highlight": "npm:^7.25.7" + picocolors: "npm:^1.0.0" + checksum: 10c0/14825c298bdec914caf3d24d1383b6d4cd6b030714686004992f4fc251831ecf432236652896f99d5d341f17170ae9a07b58d8d7b15aa0df8cfa1c5a7d5474bc + languageName: node + linkType: hard + +"@babel/compat-data@npm:^7.25.7": + version: 7.25.8 + resolution: "@babel/compat-data@npm:7.25.8" + checksum: 10c0/8b81c17580e5fb4cbb6a3c52079f8c283fc59c0c6bd2fe14cfcf9c44b32d2eaab71b02c5633e2c679f5896f73f8ac4036ba2e67a4c806e8f428e4b11f526d7f4 + languageName: node + linkType: hard + +"@babel/core@npm:^7.24.4": + version: 7.25.8 + resolution: "@babel/core@npm:7.25.8" + dependencies: + "@ampproject/remapping": "npm:^2.2.0" + "@babel/code-frame": "npm:^7.25.7" + "@babel/generator": "npm:^7.25.7" + "@babel/helper-compilation-targets": "npm:^7.25.7" + "@babel/helper-module-transforms": "npm:^7.25.7" + "@babel/helpers": "npm:^7.25.7" + "@babel/parser": "npm:^7.25.8" + "@babel/template": "npm:^7.25.7" + "@babel/traverse": "npm:^7.25.7" + "@babel/types": "npm:^7.25.8" + convert-source-map: "npm:^2.0.0" + debug: "npm:^4.1.0" + gensync: "npm:^1.0.0-beta.2" + json5: "npm:^2.2.3" + semver: "npm:^6.3.1" + checksum: 10c0/8411ea506e6f7c8a39ab5c1524b00589fa3b087edb47389708f7fe07170929192171734666e3ea10b95a951643a531a6d09eedfe071572c9ea28516646265086 + languageName: node + linkType: hard + "@babel/generator@npm:7.2.0": version: 7.2.0 resolution: "@babel/generator@npm:7.2.0" @@ -18,35 +68,247 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/helper-string-parser@npm:7.24.8" - checksum: 10c0/6361f72076c17fabf305e252bf6d580106429014b3ab3c1f5c4eb3e6d465536ea6b670cc0e9a637a77a9ad40454d3e41361a2909e70e305116a23d68ce094c08 +"@babel/generator@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/generator@npm:7.25.7" + dependencies: + "@babel/types": "npm:^7.25.7" + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.25" + jsesc: "npm:^3.0.2" + checksum: 10c0/c03a26c79864d60d04ce36b649c3fa0d6fd7b2bf6a22e22854a0457aa09206508392dd73ee40e7bc8d50b3602f9ff068afa47770cda091d332e7db1ca382ee96 + languageName: node + linkType: hard + +"@babel/helper-annotate-as-pure@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-annotate-as-pure@npm:7.25.7" + dependencies: + "@babel/types": "npm:^7.25.7" + checksum: 10c0/2f020b0fa9d336b5778485cc2de3141561ec436a7591b685457a5bcdae4ce41d9ddee68169c95504e0789e5a4327e73b8b7e72e5b60e82e96d730c4d19255248 + languageName: node + linkType: hard + +"@babel/helper-compilation-targets@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-compilation-targets@npm:7.25.7" + dependencies: + "@babel/compat-data": "npm:^7.25.7" + "@babel/helper-validator-option": "npm:^7.25.7" + browserslist: "npm:^4.24.0" + lru-cache: "npm:^5.1.1" + semver: "npm:^6.3.1" + checksum: 10c0/705be7e5274a3fdade68e3e2cf42e2b600316ab52794e13b91299a16f16c926f15886b6e9d6df20eb943ccc1cdba5a363d4766f8d01e47b8e6f4e01175f5e66c + languageName: node + linkType: hard + +"@babel/helper-create-class-features-plugin@npm:^7.18.6": + version: 7.25.7 + resolution: "@babel/helper-create-class-features-plugin@npm:7.25.7" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.25.7" + "@babel/helper-member-expression-to-functions": "npm:^7.25.7" + "@babel/helper-optimise-call-expression": "npm:^7.25.7" + "@babel/helper-replace-supers": "npm:^7.25.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.25.7" + "@babel/traverse": "npm:^7.25.7" + semver: "npm:^6.3.1" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/405c3c1a137acda1206380a96993cf2cfd808b3bee1c11c4af47ee0f03a20858497aa53394d6adc5431793c543be5e02010620e871a5ab39d938ae90a54b50f2 + languageName: node + linkType: hard + +"@babel/helper-member-expression-to-functions@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-member-expression-to-functions@npm:7.25.7" + dependencies: + "@babel/traverse": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/1e948162ab48d84593a7c6ec9570d14c906146f1697144fc369c59dbeb00e4a062da67dd06cb0d8f98a044cd8389002dcf2ab6f5613d99c35748307846ec63fc + languageName: node + linkType: hard + +"@babel/helper-module-imports@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-module-imports@npm:7.25.7" + dependencies: + "@babel/traverse": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/0fd0c3673835e5bf75558e184bcadc47c1f6dd2fe2016d53ebe1e5a6ae931a44e093015c2f9a6651c1a89f25c76d9246710c2b0b460b95ee069c464f2837fa2c + languageName: node + linkType: hard + +"@babel/helper-module-transforms@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-module-transforms@npm:7.25.7" + dependencies: + "@babel/helper-module-imports": "npm:^7.25.7" + "@babel/helper-simple-access": "npm:^7.25.7" + "@babel/helper-validator-identifier": "npm:^7.25.7" + "@babel/traverse": "npm:^7.25.7" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/f37fa7d1d4df21690535b278468cbd5faf0133a3080f282000cfa4f3ffc9462a1458f866b04b6a2f2d1eec4691236cba9a867da61270dab3ab19846e62f05090 + languageName: node + linkType: hard + +"@babel/helper-optimise-call-expression@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-optimise-call-expression@npm:7.25.7" + dependencies: + "@babel/types": "npm:^7.25.7" + checksum: 10c0/19b4cc7e77811b1fedca4928dbc14026afef913c2ba4142e5e110ebdcb5c3b2efc0f0fbee9f362c23a194674147b9d627adea71c289b9be08b9067bc0085308b + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:^7.18.6": + version: 7.25.7 + resolution: "@babel/helper-plugin-utils@npm:7.25.7" + checksum: 10c0/241f8cf3c5b7700e91cab7cfe5b432a3c710ae3cd5bb96dc554da536a6d25f5b9f000cc0c0917501ceb4f76ba92599ee3beb25e10adaf96be59f8df89a842faf + languageName: node + linkType: hard + +"@babel/helper-replace-supers@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-replace-supers@npm:7.25.7" + dependencies: + "@babel/helper-member-expression-to-functions": "npm:^7.25.7" + "@babel/helper-optimise-call-expression": "npm:^7.25.7" + "@babel/traverse": "npm:^7.25.7" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/761d64ee74429f7326a6aa65e2cd5bfcb8de9e3bc3f1efb14b8f610d2410f003b0fca52778dc801d49ff8fbc90b057e8f51b27c62b0b05c95eaf23140ca1287b + languageName: node + linkType: hard + +"@babel/helper-simple-access@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-simple-access@npm:7.25.7" + dependencies: + "@babel/traverse": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/eed1b499bfb4f613c18debd61517e3de77b6da2727ca025aa05ac81599e0269f1dddb5237db04e8bb598115d015874752e0a7f11ff38672d74a4976097417059 + languageName: node + linkType: hard + +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.25.7" + dependencies: + "@babel/traverse": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/5804adb893849a9d8cfb548e3812566a81d95cb0c9a10d66b52912d13f488e577c33063bf19bc06ac70e6333162a7370d67ba1a1c3544d37fb50d5f4a00db4de + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-string-parser@npm:7.25.7" + checksum: 10c0/73ef2ceb81f8294678a0afe8ab0103729c0370cac2e830e0d5128b03be5f6a2635838af31d391d763e3c5a4460ed96f42fd7c9b552130670d525be665913bc4c + languageName: node + linkType: hard + +"@babel/helper-validator-identifier@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-validator-identifier@npm:7.25.7" + checksum: 10c0/07438e5bf01ab2882a15027fdf39ac3b0ba1b251774a5130917907014684e2f70fef8fd620137ca062c4c4eedc388508d2ea7a3a7d9936a32785f4fe116c68c0 + languageName: node + linkType: hard + +"@babel/helper-validator-option@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-validator-option@npm:7.25.7" + checksum: 10c0/12ed418c8e3ed9ed44c8c80d823f4e42d399b5eb2e423adccb975e31a31a008cd3b5d8eab688b31f740caff4a1bb28fe06ea2fa7d635aee34cc0ad6995d50f0a + languageName: node + linkType: hard + +"@babel/helpers@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helpers@npm:7.25.7" + dependencies: + "@babel/template": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/3b3ae9e373bd785414195ef8f59976a69d5a6ebe0ef2165fdcc5165e5c3ee09e0fcee94bb457df2ddb8c0532e4146d0a9b7a96b3497399a4bff4ffe196b30228 + languageName: node + linkType: hard + +"@babel/highlight@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/highlight@npm:7.25.7" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.25.7" + chalk: "npm:^2.4.2" + js-tokens: "npm:^4.0.0" + picocolors: "npm:^1.0.0" + checksum: 10c0/1f5894fdb0a0af6101fb2822369b2eeeae32cbeae2ef73ff73fc6a0a4a20471565cd9cfa589f54ed69df66adeca7c57266031ca9134b7bd244d023a488d419aa + languageName: node + linkType: hard + +"@babel/parser@npm:^7.24.4, @babel/parser@npm:^7.25.7, @babel/parser@npm:^7.25.8": + version: 7.25.8 + resolution: "@babel/parser@npm:7.25.8" + dependencies: + "@babel/types": "npm:^7.25.8" + bin: + parser: ./bin/babel-parser.js + checksum: 10c0/a1a13845b7e8dda4c970791814a4bbf60004969882f18f470e260ad822d2e1f8941948f851e9335895563610f240fa6c98481ce8019865e469502bbf21daafa4 + languageName: node + linkType: hard + +"@babel/plugin-proposal-private-methods@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/plugin-proposal-private-methods@npm:7.18.6" + dependencies: + "@babel/helper-create-class-features-plugin": "npm:^7.18.6" + "@babel/helper-plugin-utils": "npm:^7.18.6" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/1c273d0ec3d49d0fe80bd754ec0191016e5b3ab4fb1e162ac0c014e9d3c1517a5d973afbf8b6dc9f9c98a8605c79e5f9e8b5ee158a4313fa68d1ff7b02084b6a + languageName: node + linkType: hard + +"@babel/template@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/template@npm:7.25.7" + dependencies: + "@babel/code-frame": "npm:^7.25.7" + "@babel/parser": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + checksum: 10c0/8ae9e36e4330ee83d4832531d1d9bec7dc2ef6a2a8afa1ef1229506fd60667abcb17f306d1c3d7e582251270597022990c845d5d69e7add70a5aea66720decb9 languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-validator-identifier@npm:7.24.7" - checksum: 10c0/87ad608694c9477814093ed5b5c080c2e06d44cb1924ae8320474a74415241223cc2a725eea2640dd783ff1e3390e5f95eede978bc540e870053152e58f1d651 +"@babel/traverse@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/traverse@npm:7.25.7" + dependencies: + "@babel/code-frame": "npm:^7.25.7" + "@babel/generator": "npm:^7.25.7" + "@babel/parser": "npm:^7.25.7" + "@babel/template": "npm:^7.25.7" + "@babel/types": "npm:^7.25.7" + debug: "npm:^4.3.1" + globals: "npm:^11.1.0" + checksum: 10c0/75d73e52c507a7a7a4c7971d6bf4f8f26fdd094e0d3a0193d77edf6a5efa36fc3db91ec5cc48e8b94e6eb5d5ad21af0a1040e71309172851209415fd105efb1a languageName: node linkType: hard -"@babel/types@npm:^7.19.0, @babel/types@npm:^7.2.0": - version: 7.25.2 - resolution: "@babel/types@npm:7.25.2" +"@babel/types@npm:^7.19.0, @babel/types@npm:^7.2.0, @babel/types@npm:^7.25.7, @babel/types@npm:^7.25.8": + version: 7.25.8 + resolution: "@babel/types@npm:7.25.8" dependencies: - "@babel/helper-string-parser": "npm:^7.24.8" - "@babel/helper-validator-identifier": "npm:^7.24.7" + "@babel/helper-string-parser": "npm:^7.25.7" + "@babel/helper-validator-identifier": "npm:^7.25.7" to-fast-properties: "npm:^2.0.0" - checksum: 10c0/e489435856be239f8cc1120c90a197e4c2865385121908e5edb7223cfdff3768cba18f489adfe0c26955d9e7bbb1fb10625bc2517505908ceb0af848989bd864 + checksum: 10c0/55ca2d6df6426c98db2769ce884ce5e9de83a512ea2dd7bcf56c811984dc14351cacf42932a723630c5afcff2455809323decd645820762182f10b7b5252b59f languageName: node linkType: hard -"@drizzle-team/brocli@npm:^0.10.1": - version: 0.10.1 - resolution: "@drizzle-team/brocli@npm:0.10.1" - checksum: 10c0/64a1678a5a5cf4a16f955175fd6f9df8ff61e5de24473d5c7efa699e8145a54574584bd22f8036c77d0d35666ff97f11a5b006191ca40f5d3deb0006258cd806 +"@drizzle-team/brocli@npm:^0.10.2": + version: 0.10.2 + resolution: "@drizzle-team/brocli@npm:0.10.2" + checksum: 10c0/3d8b99d680f0b14fea32b45c59b938b6665e0840cc67f04801b1aa3c6747da3c7d01c00e321645034fa100abdba7e0c20ce07cf46fc2ca769ee4cafd97562484 languageName: node linkType: hard @@ -95,9 +357,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/aix-ppc64@npm:0.21.5" +"@esbuild/aix-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/aix-ppc64@npm:0.23.1" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard @@ -116,9 +378,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm64@npm:0.21.5" +"@esbuild/android-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm64@npm:0.23.1" conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -137,9 +399,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm@npm:0.21.5" +"@esbuild/android-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm@npm:0.23.1" conditions: os=android & cpu=arm languageName: node linkType: hard @@ -158,9 +420,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-x64@npm:0.21.5" +"@esbuild/android-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-x64@npm:0.23.1" conditions: os=android & cpu=x64 languageName: node linkType: hard @@ -179,9 +441,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-arm64@npm:0.21.5" +"@esbuild/darwin-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-arm64@npm:0.23.1" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard @@ -200,9 +462,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-x64@npm:0.21.5" +"@esbuild/darwin-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-x64@npm:0.23.1" conditions: os=darwin & cpu=x64 languageName: node linkType: hard @@ -221,9 +483,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-arm64@npm:0.21.5" +"@esbuild/freebsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-arm64@npm:0.23.1" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard @@ -242,9 +504,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-x64@npm:0.21.5" +"@esbuild/freebsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-x64@npm:0.23.1" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard @@ -263,9 +525,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm64@npm:0.21.5" +"@esbuild/linux-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm64@npm:0.23.1" conditions: os=linux & cpu=arm64 languageName: node linkType: hard @@ -284,9 +546,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm@npm:0.21.5" +"@esbuild/linux-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm@npm:0.23.1" conditions: os=linux & cpu=arm languageName: node linkType: hard @@ -305,9 +567,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ia32@npm:0.21.5" +"@esbuild/linux-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ia32@npm:0.23.1" conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -326,9 +588,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-loong64@npm:0.21.5" +"@esbuild/linux-loong64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-loong64@npm:0.23.1" conditions: os=linux & cpu=loong64 languageName: node linkType: hard @@ -347,9 +609,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-mips64el@npm:0.21.5" +"@esbuild/linux-mips64el@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-mips64el@npm:0.23.1" conditions: os=linux & cpu=mips64el languageName: node linkType: hard @@ -368,9 +630,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ppc64@npm:0.21.5" +"@esbuild/linux-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ppc64@npm:0.23.1" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard @@ -389,9 +651,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-riscv64@npm:0.21.5" +"@esbuild/linux-riscv64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-riscv64@npm:0.23.1" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard @@ -410,9 +672,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-s390x@npm:0.21.5" +"@esbuild/linux-s390x@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-s390x@npm:0.23.1" conditions: os=linux & cpu=s390x languageName: node linkType: hard @@ -431,9 +693,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-x64@npm:0.21.5" +"@esbuild/linux-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-x64@npm:0.23.1" conditions: os=linux & cpu=x64 languageName: node linkType: hard @@ -452,13 +714,20 @@ __metadata: languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/netbsd-x64@npm:0.21.5" +"@esbuild/netbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/netbsd-x64@npm:0.23.1" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard +"@esbuild/openbsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-arm64@npm:0.23.1" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/openbsd-x64@npm:0.18.20" @@ -473,9 +742,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/openbsd-x64@npm:0.21.5" +"@esbuild/openbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-x64@npm:0.23.1" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard @@ -494,9 +763,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/sunos-x64@npm:0.21.5" +"@esbuild/sunos-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/sunos-x64@npm:0.23.1" conditions: os=sunos & cpu=x64 languageName: node linkType: hard @@ -515,9 +784,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-arm64@npm:0.21.5" +"@esbuild/win32-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-arm64@npm:0.23.1" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard @@ -536,9 +805,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-ia32@npm:0.21.5" +"@esbuild/win32-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-ia32@npm:0.23.1" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard @@ -557,9 +826,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-x64@npm:0.21.5" +"@esbuild/win32-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-x64@npm:0.23.1" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -1091,6 +1360,48 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.5 + resolution: "@jridgewell/gen-mapping@npm:0.3.5" + dependencies: + "@jridgewell/set-array": "npm:^1.2.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/1be4fd4a6b0f41337c4f5fdf4afc3bd19e39c3691924817108b82ffcb9c9e609c273f936932b9fba4b3a298ce2eb06d9bff4eb1cc3bd81c4f4ee1b4917e25feb + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.2 + resolution: "@jridgewell/resolve-uri@npm:3.1.2" + checksum: 10c0/d502e6fb516b35032331406d4e962c21fe77cdf1cbdb49c6142bcbd9e30507094b18972778a6e27cbad756209cfe34b1a27729e6fa08a2eb92b33943f680cf1e + languageName: node + linkType: hard + +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 10c0/2a5aa7b4b5c3464c895c802d8ae3f3d2b92fcbe84ad12f8d0bfbb1f5ad006717e7577ee1fd2eac00c088abe486c7adb27976f45d2941ff6b0b92b2c3302c60f4 + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 10c0/2eb864f276eb1096c3c11da3e9bb518f6d9fc0023c78344cdc037abadc725172c70314bdb360f2d4b7bffec7f5d657ce006816bc5d4ecb35e61b66132db00c18 + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 10c0/3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 + languageName: node + linkType: hard + "@mdx-js/loader@npm:^3.0.1": version: 3.0.1 resolution: "@mdx-js/loader@npm:3.0.1" @@ -1146,25 +1457,25 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/env@npm:15.0.0-rc.1" - checksum: 10c0/cb743229a9216a748f014e047b126d37b088e1e179734248c6a2f273ff5b8abf778de06bb7c5d506a417277de8ea8f79c873d2a5db8e99aae34c69a1e2b75a29 +"@next/env@npm:15.0.0": + version: 15.0.0 + resolution: "@next/env@npm:15.0.0" + checksum: 10c0/cc01e37af13a2a8fada74b2ee335dcd0a16424461a4316c26776fbb768491288a166075a2bcf8e0ab1afd6e66026c4e30bf9f9026dd693ac657ccff7d17aa4bc languageName: node linkType: hard -"@next/eslint-plugin-next@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/eslint-plugin-next@npm:15.0.0-rc.1" +"@next/eslint-plugin-next@npm:15.0.0": + version: 15.0.0 + resolution: "@next/eslint-plugin-next@npm:15.0.0" dependencies: fast-glob: "npm:3.3.1" - checksum: 10c0/87dae774ab90ffbdddf6aee9da5b004322fb5701c236a3778eb586c0c1e719d39b9b2fe106dc2ca37fe1dcc75a25cd7999d7cff85e6817a2cc0305f77963885a + checksum: 10c0/85f80f99f348448be42ca1db3437428c52fec1b275605d3c67d5e8133844e9ceaebfda1d12acb14114712a39127636acced77588fea3bb43cda8513940d7ee9c languageName: node linkType: hard -"@next/mdx@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/mdx@npm:15.0.0-rc.1" +"@next/mdx@npm:^15.0.0": + version: 15.0.0 + resolution: "@next/mdx@npm:15.0.0" dependencies: source-map: "npm:^0.7.0" peerDependencies: @@ -1175,62 +1486,62 @@ __metadata: optional: true "@mdx-js/react": optional: true - checksum: 10c0/8cbe3d93359a3fcee60d3fd09deb308b5efb54992b54f44763004eae700783921d66a284f749b7a76f0fe14ea2d5d32b719d353e7e44bd44d97dddf569f16abd + checksum: 10c0/c207c4c21b08ff864ef0b544da5fb48627c9372a76144d5bc359c4e7505f807faf3536c3afdabef2251c41f8eb95c6aaad66fc29a64d68038c411dd1c894cfd0 languageName: node linkType: hard -"@next/swc-darwin-arm64@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-darwin-arm64@npm:15.0.0-rc.1" +"@next/swc-darwin-arm64@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-darwin-arm64@npm:15.0.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-darwin-x64@npm:15.0.0-rc.1" +"@next/swc-darwin-x64@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-darwin-x64@npm:15.0.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-arm64-gnu@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-linux-arm64-gnu@npm:15.0.0-rc.1" +"@next/swc-linux-arm64-gnu@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-linux-arm64-gnu@npm:15.0.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-linux-arm64-musl@npm:15.0.0-rc.1" +"@next/swc-linux-arm64-musl@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-linux-arm64-musl@npm:15.0.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-linux-x64-gnu@npm:15.0.0-rc.1" +"@next/swc-linux-x64-gnu@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-linux-x64-gnu@npm:15.0.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-linux-x64-musl@npm:15.0.0-rc.1" +"@next/swc-linux-x64-musl@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-linux-x64-musl@npm:15.0.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-win32-arm64-msvc@npm:15.0.0-rc.1" +"@next/swc-win32-arm64-msvc@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-win32-arm64-msvc@npm:15.0.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "@next/swc-win32-x64-msvc@npm:15.0.0-rc.1" +"@next/swc-win32-x64-msvc@npm:15.0.0": + version: 15.0.0 + resolution: "@next/swc-win32-x64-msvc@npm:15.0.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -2483,7 +2794,7 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^3.2.0": +"ansi-styles@npm:^3.2.0, ansi-styles@npm:^3.2.1": version: 3.2.1 resolution: "ansi-styles@npm:3.2.1" dependencies: @@ -2677,9 +2988,9 @@ __metadata: languageName: node linkType: hard -"babel-plugin-react-compiler@npm:0.0.0-experimental-696af53-20240625": - version: 0.0.0-experimental-696af53-20240625 - resolution: "babel-plugin-react-compiler@npm:0.0.0-experimental-696af53-20240625" +"babel-plugin-react-compiler@npm:19.0.0-beta-8a03594-20241020": + version: 19.0.0-beta-8a03594-20241020 + resolution: "babel-plugin-react-compiler@npm:19.0.0-beta-8a03594-20241020" dependencies: "@babel/generator": "npm:7.2.0" "@babel/types": "npm:^7.19.0" @@ -2688,7 +2999,7 @@ __metadata: pretty-format: "npm:^24" zod: "npm:^3.22.4" zod-validation-error: "npm:^2.1.0" - checksum: 10c0/de1cbb59688932c3de70486e84cc0f4b0bb91d77b03cba0e30fb8b40a796fd4a450f14ded4e0f7b14b3003b59aad1c5f95a74e8138633ef6805cae7f2d3b97bf + checksum: 10c0/e14c535849b8880633184b3d144862791d673999dd1c5165c6eebcf768b9b62cbca1dcdebbcd537f4b315d149e8447d52bda2b8081eeb63a28de25b0d71d5a99 languageName: node linkType: hard @@ -2734,6 +3045,20 @@ __metadata: languageName: node linkType: hard +"browserslist@npm:^4.24.0": + version: 4.24.2 + resolution: "browserslist@npm:4.24.2" + dependencies: + caniuse-lite: "npm:^1.0.30001669" + electron-to-chromium: "npm:^1.5.41" + node-releases: "npm:^2.0.18" + update-browserslist-db: "npm:^1.1.1" + bin: + browserslist: cli.js + checksum: 10c0/d747c9fb65ed7b4f1abcae4959405707ed9a7b835639f8a9ba0da2911995a6ab9b0648fd05baf2a4d4e3cf7f9fdbad56d3753f91881e365992c1d49c8d88ff7a + languageName: node + linkType: hard + "buffer-from@npm:^1.0.0": version: 1.1.2 resolution: "buffer-from@npm:1.1.2" @@ -2797,6 +3122,13 @@ __metadata: languageName: node linkType: hard +"caniuse-lite@npm:^1.0.30001669": + version: 1.0.30001669 + resolution: "caniuse-lite@npm:1.0.30001669" + checksum: 10c0/f125f23440d3dbb6c25ffb8d55f4ce48af36a84d0932b152b3b74f143a4170cbe92e02b0a9676209c86609bf7bf34119ff10cc2bc7c1b7ea40e936cc16598408 + languageName: node + linkType: hard + "ccount@npm:^2.0.0": version: 2.0.1 resolution: "ccount@npm:2.0.1" @@ -2814,6 +3146,17 @@ __metadata: languageName: node linkType: hard +"chalk@npm:^2.4.2": + version: 2.4.2 + resolution: "chalk@npm:2.4.2" + dependencies: + ansi-styles: "npm:^3.2.1" + escape-string-regexp: "npm:^1.0.5" + supports-color: "npm:^5.3.0" + checksum: 10c0/e6543f02ec877732e3a2d1c3c3323ddb4d39fbab687c23f526e25bd4c6a9bf3b83a696e8c769d078e04e5754921648f7821b2a2acfd16c550435fd630026e073 + languageName: node + linkType: hard + "character-entities-html4@npm:^2.0.0": version: 2.1.0 resolution: "character-entities-html4@npm:2.1.0" @@ -2959,6 +3302,13 @@ __metadata: languageName: node linkType: hard +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 10c0/8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b + languageName: node + linkType: hard + "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -3038,6 +3388,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.1.0": + version: 4.3.7 + resolution: "debug@npm:4.3.7" + dependencies: + ms: "npm:^2.1.3" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b + languageName: node + linkType: hard + "decode-named-character-reference@npm:^1.0.0": version: 1.0.2 resolution: "decode-named-character-reference@npm:1.0.2" @@ -3150,28 +3512,29 @@ __metadata: languageName: node linkType: hard -"drizzle-kit@npm:^0.24.1": - version: 0.24.1 - resolution: "drizzle-kit@npm:0.24.1" +"drizzle-kit@npm:^0.27.0": + version: 0.27.0 + resolution: "drizzle-kit@npm:0.27.0" dependencies: - "@drizzle-team/brocli": "npm:^0.10.1" + "@drizzle-team/brocli": "npm:^0.10.2" "@esbuild-kit/esm-loader": "npm:^2.5.5" esbuild: "npm:^0.19.7" esbuild-register: "npm:^3.5.0" bin: drizzle-kit: bin.cjs - checksum: 10c0/dab092bc9f7a8791b9406f040c94e8e0601152224669e16c522409d75d35692f04dbcbc3e2ecbe030071fdfacb74659f8c3070c22f1bfc3e647dcf3275a2d8f5 + checksum: 10c0/57810f19375e3e6ac14371f0a2bcd7d4f584ca55a8953a043202a8eb5d3af1eaa2fb2cf4a451ee36130f692d67fa49f85194c740e1b33276bceb26b7d947d7b4 languageName: node linkType: hard -"drizzle-orm@npm:^0.33.0": - version: 0.33.0 - resolution: "drizzle-orm@npm:0.33.0" +"drizzle-orm@npm:^0.36.0": + version: 0.36.0 + resolution: "drizzle-orm@npm:0.36.0" peerDependencies: "@aws-sdk/client-rds-data": ">=3" "@cloudflare/workers-types": ">=3" - "@electric-sql/pglite": ">=0.1.1" - "@libsql/client": "*" + "@electric-sql/pglite": ">=0.2.0" + "@libsql/client": ">=0.10.0" + "@libsql/client-wasm": ">=0.10.0" "@neondatabase/serverless": ">=0.1" "@op-engineering/op-sqlite": ">=2" "@opentelemetry/api": ^1.4.1 @@ -3204,6 +3567,8 @@ __metadata: optional: true "@libsql/client": optional: true + "@libsql/client-wasm": + optional: true "@neondatabase/serverless": optional: true "@op-engineering/op-sqlite": @@ -3252,7 +3617,7 @@ __metadata: optional: true sqlite3: optional: true - checksum: 10c0/62626e355c3962e963a62b3dbeb9279de709a7b00451ee6722b8b05605cf878bb54633f51d536a5df59d43efa1ae39645af7ddb4283bdbe66d9d467aee3d5b2e + checksum: 10c0/a92cc827c41f2a0642546e004848f8dc220e9630f8e0913c35be3f83272d0d9d6384236d350115078adbd929764ca6194abd29eea50410bdec842f69389c047e languageName: node linkType: hard @@ -3263,6 +3628,13 @@ __metadata: languageName: node linkType: hard +"electron-to-chromium@npm:^1.5.41": + version: 1.5.42 + resolution: "electron-to-chromium@npm:1.5.42" + checksum: 10c0/5a3a206a35f5a0894626f6f2a001e3b56a4d94af3193260e2819e8ecb2ee8ba1176e639b833a03fff5af8bfaafb0c3931b26a4421f79e2a58e85fd5bf02221f8 + languageName: node + linkType: hard + "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -3627,33 +3999,34 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:~0.21.5": - version: 0.21.5 - resolution: "esbuild@npm:0.21.5" - dependencies: - "@esbuild/aix-ppc64": "npm:0.21.5" - "@esbuild/android-arm": "npm:0.21.5" - "@esbuild/android-arm64": "npm:0.21.5" - "@esbuild/android-x64": "npm:0.21.5" - "@esbuild/darwin-arm64": "npm:0.21.5" - "@esbuild/darwin-x64": "npm:0.21.5" - "@esbuild/freebsd-arm64": "npm:0.21.5" - "@esbuild/freebsd-x64": "npm:0.21.5" - "@esbuild/linux-arm": "npm:0.21.5" - "@esbuild/linux-arm64": "npm:0.21.5" - "@esbuild/linux-ia32": "npm:0.21.5" - "@esbuild/linux-loong64": "npm:0.21.5" - "@esbuild/linux-mips64el": "npm:0.21.5" - "@esbuild/linux-ppc64": "npm:0.21.5" - "@esbuild/linux-riscv64": "npm:0.21.5" - "@esbuild/linux-s390x": "npm:0.21.5" - "@esbuild/linux-x64": "npm:0.21.5" - "@esbuild/netbsd-x64": "npm:0.21.5" - "@esbuild/openbsd-x64": "npm:0.21.5" - "@esbuild/sunos-x64": "npm:0.21.5" - "@esbuild/win32-arm64": "npm:0.21.5" - "@esbuild/win32-ia32": "npm:0.21.5" - "@esbuild/win32-x64": "npm:0.21.5" +"esbuild@npm:~0.23.0": + version: 0.23.1 + resolution: "esbuild@npm:0.23.1" + dependencies: + "@esbuild/aix-ppc64": "npm:0.23.1" + "@esbuild/android-arm": "npm:0.23.1" + "@esbuild/android-arm64": "npm:0.23.1" + "@esbuild/android-x64": "npm:0.23.1" + "@esbuild/darwin-arm64": "npm:0.23.1" + "@esbuild/darwin-x64": "npm:0.23.1" + "@esbuild/freebsd-arm64": "npm:0.23.1" + "@esbuild/freebsd-x64": "npm:0.23.1" + "@esbuild/linux-arm": "npm:0.23.1" + "@esbuild/linux-arm64": "npm:0.23.1" + "@esbuild/linux-ia32": "npm:0.23.1" + "@esbuild/linux-loong64": "npm:0.23.1" + "@esbuild/linux-mips64el": "npm:0.23.1" + "@esbuild/linux-ppc64": "npm:0.23.1" + "@esbuild/linux-riscv64": "npm:0.23.1" + "@esbuild/linux-s390x": "npm:0.23.1" + "@esbuild/linux-x64": "npm:0.23.1" + "@esbuild/netbsd-x64": "npm:0.23.1" + "@esbuild/openbsd-arm64": "npm:0.23.1" + "@esbuild/openbsd-x64": "npm:0.23.1" + "@esbuild/sunos-x64": "npm:0.23.1" + "@esbuild/win32-arm64": "npm:0.23.1" + "@esbuild/win32-ia32": "npm:0.23.1" + "@esbuild/win32-x64": "npm:0.23.1" dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -3691,6 +4064,8 @@ __metadata: optional: true "@esbuild/netbsd-x64": optional: true + "@esbuild/openbsd-arm64": + optional: true "@esbuild/openbsd-x64": optional: true "@esbuild/sunos-x64": @@ -3703,7 +4078,21 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 10c0/fa08508adf683c3f399e8a014a6382a6b65542213431e26206c0720e536b31c09b50798747c2a105a4bbba1d9767b8d3615a74c2f7bf1ddf6d836cd11eb672de + checksum: 10c0/08c2ed1105cc3c5e3a24a771e35532fe6089dd24a39c10097899072cef4a99f20860e41e9294e000d86380f353b04d8c50af482483d7f69f5208481cce61eec7 + languageName: node + linkType: hard + +"escalade@npm:^3.2.0": + version: 3.2.0 + resolution: "escalade@npm:3.2.0" + checksum: 10c0/ced4dd3a78e15897ed3be74e635110bbf3b08877b0a41be50dcb325ee0e0b5f65fc2d50e9845194d7c4633f327e2e1c6cce00a71b617c5673df0374201d67f65 + languageName: node + linkType: hard + +"escape-string-regexp@npm:^1.0.5": + version: 1.0.5 + resolution: "escape-string-regexp@npm:1.0.5" + checksum: 10c0/a968ad453dd0c2724e14a4f20e177aaf32bb384ab41b674a8454afe9a41c5e6fe8903323e0a1052f56289d04bd600f81278edf140b0fcc02f5cac98d0f5b5371 languageName: node linkType: hard @@ -3714,11 +4103,11 @@ __metadata: languageName: node linkType: hard -"eslint-config-next@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "eslint-config-next@npm:15.0.0-rc.1" +"eslint-config-next@npm:^15.0.0": + version: 15.0.0 + resolution: "eslint-config-next@npm:15.0.0" dependencies: - "@next/eslint-plugin-next": "npm:15.0.0-rc.1" + "@next/eslint-plugin-next": "npm:15.0.0" "@rushstack/eslint-patch": "npm:^1.10.3" "@typescript-eslint/eslint-plugin": "npm:^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" "@typescript-eslint/parser": "npm:^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0" @@ -3734,7 +4123,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/b7b6a9cfafde90fe880831a4ea7aed66e095f6f4e5e0f00ac464a6559f218bf92267b7bab00c1387bd3204a31e11676d99cd58ceef1cedc2bc668e33a88991e2 + checksum: 10c0/dcb9a049aea7235f8b0f7b24fed7d2c2f8aa72254f622b87402d3fb6a80742150522efa7be8fd5f157a77c34d04ce15310d2ccf9b2f8781c9f6bd1fe384f1637 languageName: node linkType: hard @@ -3846,6 +4235,22 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-react-compiler@npm:19.0.0-beta-8a03594-20241020": + version: 19.0.0-beta-8a03594-20241020 + resolution: "eslint-plugin-react-compiler@npm:19.0.0-beta-8a03594-20241020" + dependencies: + "@babel/core": "npm:^7.24.4" + "@babel/parser": "npm:^7.24.4" + "@babel/plugin-proposal-private-methods": "npm:^7.18.6" + hermes-parser: "npm:^0.20.1" + zod: "npm:^3.22.4" + zod-validation-error: "npm:^3.0.3" + peerDependencies: + eslint: ">=7" + checksum: 10c0/550e1c284f44ece70f443580ecdbf45e94bff3a713fa9256954bdeb8d6b4d218c911e4989f2f6f7d45c1c435d8d062e4ecc0e47933def7f103cc8c20498dc249 + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^5.0.0": version: 5.0.0 resolution: "eslint-plugin-react-hooks@npm:5.0.0" @@ -4255,6 +4660,13 @@ __metadata: languageName: node linkType: hard +"gensync@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "gensync@npm:1.0.0-beta.2" + checksum: 10c0/782aba6cba65b1bb5af3b095d96249d20edbe8df32dbf4696fd49be2583faf676173bf4809386588828e4dd76a3354fcbeb577bab1c833ccd9fc4577f26103f8 + languageName: node + linkType: hard + "get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2, get-intrinsic@npm:^1.2.3, get-intrinsic@npm:^1.2.4": version: 1.2.4 resolution: "get-intrinsic@npm:1.2.4" @@ -4329,6 +4741,13 @@ __metadata: languageName: node linkType: hard +"globals@npm:^11.1.0": + version: 11.12.0 + resolution: "globals@npm:11.12.0" + checksum: 10c0/758f9f258e7b19226bd8d4af5d3b0dcf7038780fb23d82e6f98932c44e239f884847f1766e8fa9cc5635ccb3204f7fa7314d4408dd4002a5e8ea827b4018f0a1 + languageName: node + linkType: hard + "globals@npm:^14.0.0": version: 14.0.0 resolution: "globals@npm:14.0.0" @@ -4376,6 +4795,13 @@ __metadata: languageName: node linkType: hard +"has-flag@npm:^3.0.0": + version: 3.0.0 + resolution: "has-flag@npm:3.0.0" + checksum: 10c0/1c6c83b14b8b1b3c25b0727b8ba3e3b647f99e9e6e13eb7322107261de07a4c1be56fc0d45678fc376e09772a3a1642ccdaf8fc69bdf123b6c086598397ce473 + languageName: node + linkType: hard + "has-flag@npm:^4.0.0": version: 4.0.0 resolution: "has-flag@npm:4.0.0" @@ -4480,6 +4906,22 @@ __metadata: languageName: node linkType: hard +"hermes-estree@npm:0.20.1": + version: 0.20.1 + resolution: "hermes-estree@npm:0.20.1" + checksum: 10c0/86cfb395970f50fdac09ad9784a86b65c7187d02b5f99f0f0321d936aa9ec52d1e07aef02c21b18b649abdec5f6acc02eb6275edf7d33b4d3d23e3fa0af85c41 + languageName: node + linkType: hard + +"hermes-parser@npm:^0.20.1": + version: 0.20.1 + resolution: "hermes-parser@npm:0.20.1" + dependencies: + hermes-estree: "npm:0.20.1" + checksum: 10c0/b93746028feac7d1dccd54f8b420e8f7d6e0adf9ff0bdbdf9bb1f327198da91ca7f893af62fba99ac9a57bfd5f15dcb90cca40cf4e1a090a6ea8ab2160a02f86 + languageName: node + linkType: hard + "http-cache-semantics@npm:^4.1.1": version: 4.1.1 resolution: "http-cache-semantics@npm:4.1.1" @@ -4954,7 +5396,7 @@ __metadata: languageName: node linkType: hard -"js-tokens@npm:^3.0.0 || ^4.0.0": +"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" checksum: 10c0/e248708d377aa058eacf2037b07ded847790e6de892bbad3dac0abba2e759cb9f121b00099a65195616badcb6eca8d14d975cb3e89eb1cfda644756402c8aeed @@ -4988,6 +5430,15 @@ __metadata: languageName: node linkType: hard +"jsesc@npm:^3.0.2": + version: 3.0.2 + resolution: "jsesc@npm:3.0.2" + bin: + jsesc: bin/jsesc + checksum: 10c0/ef22148f9e793180b14d8a145ee6f9f60f301abf443288117b4b6c53d0ecd58354898dc506ccbb553a5f7827965cd38bc5fb726575aae93c5e8915e2de8290e1 + languageName: node + linkType: hard + "json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -5020,6 +5471,15 @@ __metadata: languageName: node linkType: hard +"json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 10c0/5a04eed94810fa55c5ea138b2f7a5c12b97c3750bc63d11e511dcecbfef758003861522a070c2272764ee0f4e3e323862f386945aeb5b85b87ee43f084ba586c + languageName: node + linkType: hard + "jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.5": version: 3.3.5 resolution: "jsx-ast-utils@npm:3.3.5" @@ -5215,6 +5675,15 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: "npm:^3.0.2" + checksum: 10c0/89b2ef2ef45f543011e38737b8a8622a2f8998cddf0e5437174ef8f1f70a8b9d14a918ab3e232cb3ba343b7abddffa667f0b59075b2b80e6b4d63c3de6127482 + languageName: node + linkType: hard + "lucide-react@npm:^0.427.0": version: 0.427.0 resolution: "lucide-react@npm:0.427.0" @@ -5871,7 +6340,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:^2.1.1": +"ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 @@ -5911,19 +6380,19 @@ __metadata: languageName: node linkType: hard -"next@npm:15.0.0-rc.1": - version: 15.0.0-rc.1 - resolution: "next@npm:15.0.0-rc.1" +"next@npm:^15.0.0": + version: 15.0.0 + resolution: "next@npm:15.0.0" dependencies: - "@next/env": "npm:15.0.0-rc.1" - "@next/swc-darwin-arm64": "npm:15.0.0-rc.1" - "@next/swc-darwin-x64": "npm:15.0.0-rc.1" - "@next/swc-linux-arm64-gnu": "npm:15.0.0-rc.1" - "@next/swc-linux-arm64-musl": "npm:15.0.0-rc.1" - "@next/swc-linux-x64-gnu": "npm:15.0.0-rc.1" - "@next/swc-linux-x64-musl": "npm:15.0.0-rc.1" - "@next/swc-win32-arm64-msvc": "npm:15.0.0-rc.1" - "@next/swc-win32-x64-msvc": "npm:15.0.0-rc.1" + "@next/env": "npm:15.0.0" + "@next/swc-darwin-arm64": "npm:15.0.0" + "@next/swc-darwin-x64": "npm:15.0.0" + "@next/swc-linux-arm64-gnu": "npm:15.0.0" + "@next/swc-linux-arm64-musl": "npm:15.0.0" + "@next/swc-linux-x64-gnu": "npm:15.0.0" + "@next/swc-linux-x64-musl": "npm:15.0.0" + "@next/swc-win32-arm64-msvc": "npm:15.0.0" + "@next/swc-win32-x64-msvc": "npm:15.0.0" "@swc/counter": "npm:0.1.3" "@swc/helpers": "npm:0.5.13" busboy: "npm:1.6.0" @@ -5935,8 +6404,8 @@ __metadata: "@opentelemetry/api": ^1.1.0 "@playwright/test": ^1.41.2 babel-plugin-react-compiler: "*" - react: ^18.2.0 || 19.0.0-rc-cd22717c-20241013 - react-dom: ^18.2.0 || 19.0.0-rc-cd22717c-20241013 + react: ^18.2.0 || 19.0.0-rc-65a56d0e-20241020 + react-dom: ^18.2.0 || 19.0.0-rc-65a56d0e-20241020 sass: ^1.3.0 dependenciesMeta: "@next/swc-darwin-arm64": @@ -5968,7 +6437,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: 10c0/1df689eea76f90f4e2d5465706a21c0a4966e02e3a4494737d06b491764b9a0929bc7370ff5543a475c974fe342336cb6a3f677690effca357631e1dc081a8de + checksum: 10c0/79614fb29c1806f945da4400a86028c875b6d69e532551c53458e6e20b39019b100ccdc051005a41a77eb2d7900363f2537b1117f6bcf3c4a6356eda5db8c84e languageName: node linkType: hard @@ -5992,6 +6461,13 @@ __metadata: languageName: node linkType: hard +"node-releases@npm:^2.0.18": + version: 2.0.18 + resolution: "node-releases@npm:2.0.18" + checksum: 10c0/786ac9db9d7226339e1dc84bbb42007cb054a346bd9257e6aa154d294f01bc6a6cddb1348fa099f079be6580acbb470e3c048effd5f719325abd0179e566fd27 + languageName: node + linkType: hard + "nopt@npm:^7.0.0": version: 7.2.1 resolution: "nopt@npm:7.2.1" @@ -6213,6 +6689,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.1.0": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58 + languageName: node + linkType: hard + "picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -6234,7 +6717,7 @@ __metadata: "@faker-js/faker": "npm:^9.0.0" "@mdx-js/loader": "npm:^3.0.1" "@mdx-js/react": "npm:^3.0.1" - "@next/mdx": "npm:15.0.0-rc.1" + "@next/mdx": "npm:^15.0.0" "@radix-ui/react-avatar": "npm:^1.1.0" "@radix-ui/react-dialog": "npm:^1.1.1" "@radix-ui/react-dropdown-menu": "npm:^2.1.1" @@ -6249,18 +6732,19 @@ __metadata: "@types/node": "npm:^20" "@types/react": "npm:types-react@19.0.0-rc.1" "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1" - babel-plugin-react-compiler: "npm:0.0.0-experimental-696af53-20240625" + babel-plugin-react-compiler: "npm:19.0.0-beta-8a03594-20241020" class-variance-authority: "npm:^0.7.0" clsx: "npm:^2.1.1" - drizzle-kit: "npm:^0.24.1" - drizzle-orm: "npm:^0.33.0" + drizzle-kit: "npm:^0.27.0" + drizzle-orm: "npm:^0.36.0" eslint: "npm:^9.12.0" - eslint-config-next: "npm:15.0.0-rc.1" + eslint-config-next: "npm:^15.0.0" + eslint-plugin-react-compiler: "npm:19.0.0-beta-8a03594-20241020" jose: "npm:^5.6.3" lucide-react: "npm:^0.427.0" - next: "npm:15.0.0-rc.1" + next: "npm:^15.0.0" next-themes: "npm:^0.3.0" - postgres: "npm:^3.4.4" + postgres: "npm:^3.4.5" prettier: "npm:^3.3.2" prettier-plugin-tailwindcss: "npm:^0.6.5" react: "npm:19.0.0-rc-cd22717c-20241013" @@ -6269,7 +6753,7 @@ __metadata: sharp: "npm:^0.33.4" tailwind-merge: "npm:^2.4.0" tailwindcss: "npm:^4.0.0-alpha.17" - tsx: "npm:^4.16.2" + tsx: "npm:^4.19.2" typescript: "npm:^5.5.3" languageName: unknown linkType: soft @@ -6312,10 +6796,10 @@ __metadata: languageName: node linkType: hard -"postgres@npm:^3.4.4": - version: 3.4.4 - resolution: "postgres@npm:3.4.4" - checksum: 10c0/5c01a1501a1cb8851d981b1949bffd0a0a82ac5fd8453c410fdf4d6c0f91d01e69a42b30da2d08a77a00d6ddac0ea6ce58a1aa0dd6bd3f76e9220b1176bdfe60 +"postgres@npm:^3.4.5": + version: 3.4.5 + resolution: "postgres@npm:3.4.5" + checksum: 10c0/53415acea77e97bdc1eeb861048f34964e2236e4d4d42f408fc9b901e62bfcf7443a487ebfdad18b57b468c6e297bf8d22097106a200f62eb1262eb5a71355df languageName: node linkType: hard @@ -7235,6 +7719,15 @@ __metadata: languageName: node linkType: hard +"supports-color@npm:^5.3.0": + version: 5.5.0 + resolution: "supports-color@npm:5.5.0" + dependencies: + has-flag: "npm:^3.0.0" + checksum: 10c0/6ae5ff319bfbb021f8a86da8ea1f8db52fac8bd4d499492e30ec17095b58af11f0c55f8577390a749b1c4dde691b6a0315dab78f5f54c9b3d83f8fb5905c1c05 + languageName: node + linkType: hard + "supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" @@ -7358,11 +7851,11 @@ __metadata: languageName: node linkType: hard -"tsx@npm:^4.16.2": - version: 4.16.5 - resolution: "tsx@npm:4.16.5" +"tsx@npm:^4.19.2": + version: 4.19.2 + resolution: "tsx@npm:4.19.2" dependencies: - esbuild: "npm:~0.21.5" + esbuild: "npm:~0.23.0" fsevents: "npm:~2.3.3" get-tsconfig: "npm:^4.7.5" dependenciesMeta: @@ -7370,7 +7863,7 @@ __metadata: optional: true bin: tsx: dist/cli.mjs - checksum: 10c0/e344852eee3ad8727cdf00fbdcbe7a28b8a0951f645b422098ca145cfaa61179c2b3691f11b7bc1b241e0781908f2842d9f6ff0f606f364ef7297cf0871c1a6e + checksum: 10c0/63164b889b1d170403e4d8753a6755dec371f220f5ce29a8e88f1f4d6085a784a12d8dc2ee669116611f2c72757ac9beaa3eea5c452796f541bdd2dc11753721 languageName: node linkType: hard @@ -7574,6 +8067,20 @@ __metadata: languageName: node linkType: hard +"update-browserslist-db@npm:^1.1.1": + version: 1.1.1 + resolution: "update-browserslist-db@npm:1.1.1" + dependencies: + escalade: "npm:^3.2.0" + picocolors: "npm:^1.1.0" + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: 10c0/536a2979adda2b4be81b07e311bd2f3ad5e978690987956bc5f514130ad50cac87cd22c710b686d79731e00fbee8ef43efe5fcd72baa241045209195d43dcc80 + languageName: node + linkType: hard + "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -7744,6 +8251,13 @@ __metadata: languageName: node linkType: hard +"yallist@npm:^3.0.2": + version: 3.1.1 + resolution: "yallist@npm:3.1.1" + checksum: 10c0/c66a5c46bc89af1625476f7f0f2ec3653c1a1791d2f9407cfb4c2ba812a1e1c9941416d71ba9719876530e3340a99925f697142989371b72d93b9ee628afd8c1 + languageName: node + linkType: hard + "yallist@npm:^4.0.0": version: 4.0.0 resolution: "yallist@npm:4.0.0" @@ -7767,6 +8281,15 @@ __metadata: languageName: node linkType: hard +"zod-validation-error@npm:^3.0.3": + version: 3.4.0 + resolution: "zod-validation-error@npm:3.4.0" + peerDependencies: + zod: ^3.18.0 + checksum: 10c0/aaadb0e65c834aacb12fa088663d52d9f4224b5fe6958f09b039f4ab74145fda381c8a7d470bfddf7ddd9bbb5fdfbb52739cd66958ce6d388c256a44094d1fba + languageName: node + linkType: hard + "zod@npm:^3.22.4": version: 3.23.8 resolution: "zod@npm:3.23.8"