Skip to content

Commit

Permalink
Merge pull request #35 from kumpmati/feature/basic-api
Browse files Browse the repository at this point in the history
Basic API #minor
  • Loading branch information
kumpmati authored Apr 18, 2024
2 parents 9b00b31 + 824ba72 commit 4cb0abd
Show file tree
Hide file tree
Showing 41 changed files with 2,686 additions and 216 deletions.
15 changes: 15 additions & 0 deletions drizzle/0013_charming_madame_hydra.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS "api_key" (
"id" varchar(15),
"secret" text,
"user_id" varchar(15) NOT NULL,
"timestamp" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "api_key_id_secret_pk" PRIMARY KEY("id","secret")
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "api_key_user_id_idx" ON "api_key" ("user_id");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "api_key_created_at_idx" ON "api_key" ("timestamp");--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "api_key" ADD CONSTRAINT "api_key_user_id_auth_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "auth_user"("id") ON DELETE cascade ON UPDATE cascade;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
7 changes: 7 additions & 0 deletions drizzle/0014_simple_psylocke.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE "link_visit" ALTER COLUMN "timestamp" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "api_key" ALTER COLUMN "timestamp" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "signup_token" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "signup_token" ALTER COLUMN "used_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "links" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "links" ALTER COLUMN "last_used" SET DATA TYPE timestamp with time zone;--> statement-breakpoint
ALTER TABLE "links" ALTER COLUMN "valid_until" SET DATA TYPE timestamp with time zone;
2 changes: 2 additions & 0 deletions drizzle/0015_sloppy_hardball.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "api_key" ALTER COLUMN "id" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "api_key" ALTER COLUMN "secret" SET NOT NULL;
3 changes: 3 additions & 0 deletions drizzle/0016_many_doomsday.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "api_key" RENAME COLUMN "timestamp" TO "created_at";--> statement-breakpoint
DROP INDEX IF EXISTS "api_key_created_at_idx";--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "api_key_created_at_idx" ON "api_key" ("created_at");
Loading

0 comments on commit 4cb0abd

Please sign in to comment.