Skip to content

Commit

Permalink
new resource: Mountains (#35)
Browse files Browse the repository at this point in the history
* new resource: Mountains

* meh

* todos in case i forget

* still hideous, though

* simplify

* let's go with ProseKit's `NodeJSON` type, stored in `JSONB` column type

* meh

---------

Co-authored-by: Davis SHYAKA <[email protected]>
  • Loading branch information
shyakadavis and shyakadavis authored Jul 8, 2024
1 parent 863953d commit 463eb04
Show file tree
Hide file tree
Showing 23 changed files with 5,345 additions and 17 deletions.
Binary file modified bun.lockb
Binary file not shown.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@hono-rate-limiter/cloudflare": "^0.1.1",
"@hono/zod-openapi": "^0.14.5",
"@hono-rate-limiter/cloudflare": "^0.1.2",
"@hono/zod-openapi": "^0.14.7",
"@lucia-auth/adapter-drizzle": "^1.0.7",
"@neondatabase/serverless": "^0.9.3",
"@scalar/hono-api-reference": "^0.5.72",
"@neondatabase/serverless": "^0.9.4",
"@scalar/hono-api-reference": "^0.5.92",
"arctic": "^1.9.1",
"drizzle-orm": "^0.31.2",
"esm-env": "^1.0.0",
"hono": "^4.4.5",
"hono": "^4.4.11",
"lucia": "^3.2.0",
"nanoid": "^5.0.7"
},
"devDependencies": {
"@biomejs/biome": "1.8.1",
"@cloudflare/workers-types": "^4.20240529.0",
"@cloudflare/workers-types": "^4.20240620.0",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.22.7",
"drizzle-kit": "^0.22.8",
"drizzle-zod": "^0.5.1",
"wrangler": "^3.57.2",
"wrangler": "^3.63.0",
"zod": "^3.23.8"
}
}
23 changes: 23 additions & 0 deletions src/db/migrations/0017_adorable_bishop.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS "mountains" (
"id" varchar(16) PRIMARY KEY NOT NULL,
"name" varchar(16) NOT NULL,
"description" varchar(256) NOT NULL,
"elevation" double precision NOT NULL,
"latitude" double precision NOT NULL,
"longitude" double precision NOT NULL,
"native_name" varchar(16),
"hints" varchar(16)[],
"location" varchar(16) NOT NULL,
"parent_range" varchar(16),
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "mountains_name_unique" UNIQUE("name")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mountains" ADD CONSTRAINT "mountains_location_villages_id_fk" FOREIGN KEY ("location") REFERENCES "public"."villages"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "mountains_name_index" ON "mountains" USING btree ("name");
1 change: 1 addition & 0 deletions src/db/migrations/0018_damp_winter_soldier.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "mountains" ALTER COLUMN "description" SET DATA TYPE varchar(512);
1 change: 1 addition & 0 deletions src/db/migrations/0019_peaceful_vindicator.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "mountains" ALTER COLUMN "description" SET DATA TYPE text;
1 change: 1 addition & 0 deletions src/db/migrations/0020_magical_sue_storm.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "mountains" ALTER COLUMN "description" SET DATA TYPE jsonb USING description::jsonb;
1 change: 1 addition & 0 deletions src/db/migrations/0021_rainy_living_mummy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "mountains" ALTER COLUMN "location" DROP NOT NULL;
Loading

0 comments on commit 463eb04

Please sign in to comment.