-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
863953d
commit 463eb04
Showing
23 changed files
with
5,345 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "mountains" ALTER COLUMN "description" SET DATA TYPE varchar(512); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "mountains" ALTER COLUMN "description" SET DATA TYPE text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "mountains" ALTER COLUMN "location" DROP NOT NULL; |
Oops, something went wrong.