Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GMBueno committed Sep 28, 2024
1 parent 17810a1 commit d521d27
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 463 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CREATE TABLE IF NOT EXISTS "creations" (
"id" text PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"prompt" text NOT NULL,
"url" text,
"data" jsonb NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
Expand All @@ -26,6 +27,20 @@ CREATE TABLE IF NOT EXISTS "images" (
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "trainings" (
"id" text PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" text NOT NULL,
"model_name" varchar(20) NOT NULL,
"zip_url" text NOT NULL,
"model_url" text,
"is_person_model" boolean NOT NULL,
"eye_color" varchar(20),
"gender" varchar(20),
"status" varchar(20) DEFAULT 'pending' NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
Expand Down Expand Up @@ -55,6 +70,12 @@ EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "trainings" ADD CONSTRAINT "trainings_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
CREATE INDEX IF NOT EXISTS "checkouts_created_at_idx" ON "checkouts" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "checkouts_updated_at_idx" ON "checkouts" USING btree ("updated_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "creations_user_id_idx" ON "creations" USING btree ("user_id");--> statement-breakpoint
Expand All @@ -63,6 +84,9 @@ CREATE INDEX IF NOT EXISTS "creations_updated_at_idx" ON "creations" USING btree
CREATE INDEX IF NOT EXISTS "images_user_id_idx" ON "images" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "images_created_at_idx" ON "images" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "images_updated_at_idx" ON "images" USING btree ("updated_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "trainings_user_id_idx" ON "trainings" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "trainings_created_at_idx" ON "trainings" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "trainings_updated_at_idx" ON "trainings" USING btree ("updated_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "users_email_idx" ON "users" USING btree ("email");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "users_created_at_idx" ON "users" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "users_updated_at_idx" ON "users" USING btree ("updated_at" DESC NULLS LAST);
1 change: 0 additions & 1 deletion drizzle/0001_magenta_madrox.sql

This file was deleted.

148 changes: 147 additions & 1 deletion drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "0bf17574-cf5a-487b-881b-58b06be8135f",
"id": "5817f948-e129-43a2-8a42-6f7696a5b0c8",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
Expand Down Expand Up @@ -125,6 +125,12 @@
"primaryKey": false,
"notNull": true
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"data": {
"name": "data",
"type": "jsonb",
Expand Down Expand Up @@ -321,6 +327,146 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.trainings": {
"name": "trainings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"model_name": {
"name": "model_name",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"zip_url": {
"name": "zip_url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"model_url": {
"name": "model_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_person_model": {
"name": "is_person_model",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"eye_color": {
"name": "eye_color",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"gender": {
"name": "gender",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"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": true,
"default": "now()"
}
},
"indexes": {
"trainings_user_id_idx": {
"name": "trainings_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"trainings_created_at_idx": {
"name": "trainings_created_at_idx",
"columns": [
{
"expression": "created_at",
"isExpression": false,
"asc": false,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"trainings_updated_at_idx": {
"name": "trainings_updated_at_idx",
"columns": [
{
"expression": "updated_at",
"isExpression": false,
"asc": false,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"trainings_user_id_users_id_fk": {
"name": "trainings_user_id_users_id_fk",
"tableFrom": "trainings",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.users": {
"name": "users",
"schema": "",
Expand Down
Loading

0 comments on commit d521d27

Please sign in to comment.