Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions apps/web/migrations/0002_fresh_gladiator.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
CREATE TABLE "favorites" (
"id" uuid PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"recommendation_id" uuid NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "favorites" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
CREATE TABLE "recommendations" (
"id" uuid PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"description" text NOT NULL,
"category" text NOT NULL,
"target_audience" text NOT NULL,
"location" text NOT NULL,
"country" text NOT NULL,
"city" text NOT NULL,
"address" text,
"image_url" text,
"rating" real DEFAULT 0,
"price_level" integer DEFAULT 2,
"tags" text[],
"website" text,
"phone" text,
"featured" boolean DEFAULT false,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "recommendations" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
CREATE TABLE "reviews" (
"id" uuid PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"recommendation_id" uuid NOT NULL,
"rating" integer NOT NULL,
"comment" text,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "reviews" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
ALTER TABLE "users" ALTER COLUMN "email_verified" SET DEFAULT false;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "preference_mode" text DEFAULT 'straight' NOT NULL;--> statement-breakpoint
ALTER TABLE "favorites" ADD CONSTRAINT "favorites_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "favorites" ADD CONSTRAINT "favorites_recommendation_id_recommendations_id_fk" FOREIGN KEY ("recommendation_id") REFERENCES "public"."recommendations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "reviews" ADD CONSTRAINT "reviews_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "reviews" ADD CONSTRAINT "reviews_recommendation_id_recommendations_id_fk" FOREIGN KEY ("recommendation_id") REFERENCES "public"."recommendations"("id") ON DELETE cascade ON UPDATE no action;
Loading