upd
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
CREATE TYPE "public"."chat_status" AS ENUM('active', 'closed');--> statement-breakpoint
|
||||
CREATE TYPE "public"."media_type" AS ENUM('photo', 'voice', 'video');--> statement-breakpoint
|
||||
CREATE TYPE "public"."user_status" AS ENUM('active', 'banned', 'pending');--> statement-breakpoint
|
||||
CREATE TYPE "public"."gender" AS ENUM('male', 'female');--> statement-breakpoint
|
||||
CREATE TYPE "public"."profile_media_type" AS ENUM('photo', 'video', 'audio');--> statement-breakpoint
|
||||
CREATE TYPE "public"."like_type" AS ENUM('like', 'dislike');--> statement-breakpoint
|
||||
CREATE TYPE "public"."chat_status" AS ENUM('active', 'closed');--> statement-breakpoint
|
||||
CREATE TYPE "public"."message_media_type" AS ENUM('photo', 'voice', 'video');--> statement-breakpoint
|
||||
CREATE TYPE "public"."report_entity_type" AS ENUM('profile', 'message');--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "permission" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
@@ -35,28 +37,6 @@ CREATE TABLE IF NOT EXISTS "city_district" (
|
||||
"name" varchar(200) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "chat" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"profile1_id" uuid NOT NULL,
|
||||
"profile2_id" uuid NOT NULL,
|
||||
"status" "chat_status" DEFAULT 'active' NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "greetings" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"text" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "message" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"chat_id" uuid NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"text" text,
|
||||
"media_url" text,
|
||||
"media_type" "media_type",
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "payment" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
@@ -72,30 +52,31 @@ CREATE TABLE IF NOT EXISTS "user" (
|
||||
"role_id" uuid,
|
||||
"tariff_id" uuid,
|
||||
"payment_id" uuid,
|
||||
"active_chat_id" uuid,
|
||||
"fcm_token" text,
|
||||
CONSTRAINT "user_phone_unique" UNIQUE("phone")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "media" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"path" text NOT NULL,
|
||||
"type" varchar(10) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "profile" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"birth_date" date NOT NULL,
|
||||
"gender" "gender" NOT NULL,
|
||||
"city_id" uuid,
|
||||
"district_id" uuid,
|
||||
"description" text,
|
||||
"nation" varchar(100),
|
||||
"height" double precision,
|
||||
"weight" double precision,
|
||||
CONSTRAINT "profile_user_id_unique" UNIQUE("user_id")
|
||||
"active_chat_id" uuid
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "profile_media" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"profile_id" uuid NOT NULL,
|
||||
"path" text NOT NULL,
|
||||
"type" "profile_media_type" NOT NULL,
|
||||
"sort_order" integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "profile_tag" (
|
||||
@@ -111,23 +92,45 @@ CREATE TABLE IF NOT EXISTS "tag" (
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "like" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"source_user" uuid NOT NULL,
|
||||
"target_user" uuid NOT NULL,
|
||||
"source_profile_id" uuid NOT NULL,
|
||||
"target_profile_id" uuid NOT NULL,
|
||||
"type" "like_type" NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "match" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user1_id" uuid NOT NULL,
|
||||
"user2_id" uuid NOT NULL,
|
||||
"profile1_id" uuid NOT NULL,
|
||||
"profile2_id" uuid NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "chat" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"profile1_id" uuid NOT NULL,
|
||||
"profile2_id" uuid NOT NULL,
|
||||
"status" "chat_status" DEFAULT 'active' NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "greetings" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"text" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "message" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"chat_id" uuid NOT NULL,
|
||||
"profile_id" uuid NOT NULL,
|
||||
"text" text,
|
||||
"media_url" text,
|
||||
"media_type" "message_media_type",
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "date" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user1_id" uuid NOT NULL,
|
||||
"user2_id" uuid NOT NULL,
|
||||
"profile1_id" uuid NOT NULL,
|
||||
"profile2_id" uuid NOT NULL,
|
||||
"lat" numeric(10, 7) NOT NULL,
|
||||
"lng" numeric(10, 7) NOT NULL,
|
||||
"time" timestamp with time zone NOT NULL,
|
||||
@@ -141,7 +144,7 @@ CREATE TABLE IF NOT EXISTS "date_status" (
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "report" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"source_user" uuid NOT NULL,
|
||||
"source_profile_id" uuid NOT NULL,
|
||||
"entity_id" uuid NOT NULL,
|
||||
"entity_type" "report_entity_type" NOT NULL,
|
||||
"description" text
|
||||
@@ -159,12 +162,6 @@ EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "message" ADD CONSTRAINT "message_chat_id_chat_id_fk" FOREIGN KEY ("chat_id") REFERENCES "public"."chat"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "payment" ADD CONSTRAINT "payment_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
@@ -183,12 +180,6 @@ EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "media" ADD CONSTRAINT "media_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "profile" ADD CONSTRAINT "profile_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
@@ -207,6 +198,12 @@ EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "profile_media" ADD CONSTRAINT "profile_media_profile_id_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "profile_tag" ADD CONSTRAINT "profile_tag_profile_id_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
@@ -220,37 +217,61 @@ EXCEPTION
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "like" ADD CONSTRAINT "like_source_user_user_id_fk" FOREIGN KEY ("source_user") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "like" ADD CONSTRAINT "like_source_profile_id_profile_id_fk" FOREIGN KEY ("source_profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "like" ADD CONSTRAINT "like_target_user_user_id_fk" FOREIGN KEY ("target_user") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "like" ADD CONSTRAINT "like_target_profile_id_profile_id_fk" FOREIGN KEY ("target_profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "match" ADD CONSTRAINT "match_user1_id_user_id_fk" FOREIGN KEY ("user1_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "match" ADD CONSTRAINT "match_profile1_id_profile_id_fk" FOREIGN KEY ("profile1_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "match" ADD CONSTRAINT "match_user2_id_user_id_fk" FOREIGN KEY ("user2_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "match" ADD CONSTRAINT "match_profile2_id_profile_id_fk" FOREIGN KEY ("profile2_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "date" ADD CONSTRAINT "date_user1_id_user_id_fk" FOREIGN KEY ("user1_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "chat" ADD CONSTRAINT "chat_profile1_id_profile_id_fk" FOREIGN KEY ("profile1_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "date" ADD CONSTRAINT "date_user2_id_user_id_fk" FOREIGN KEY ("user2_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "chat" ADD CONSTRAINT "chat_profile2_id_profile_id_fk" FOREIGN KEY ("profile2_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "message" ADD CONSTRAINT "message_chat_id_chat_id_fk" FOREIGN KEY ("chat_id") REFERENCES "public"."chat"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "message" ADD CONSTRAINT "message_profile_id_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "date" ADD CONSTRAINT "date_profile1_id_profile_id_fk" FOREIGN KEY ("profile1_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "date" ADD CONSTRAINT "date_profile2_id_profile_id_fk" FOREIGN KEY ("profile2_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
@@ -262,7 +283,7 @@ EXCEPTION
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "report" ADD CONSTRAINT "report_source_user_user_id_fk" FOREIGN KEY ("source_user") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "report" ADD CONSTRAINT "report_source_profile_id_profile_id_fk" FOREIGN KEY ("source_profile_id") REFERENCES "public"."profile"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
@@ -1,3 +0,0 @@
|
||||
CREATE TYPE "public"."gender" AS ENUM('male', 'female');--> statement-breakpoint
|
||||
ALTER TABLE "profile" ADD COLUMN "gender" "gender" NOT NULL DEFAULT 'male';--> statement-breakpoint
|
||||
ALTER TABLE "profile" ALTER COLUMN "gender" DROP DEFAULT;
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "3d66c7d2-fc68-4c66-ad86-4f558d519225",
|
||||
"id": "7caebd65-9149-400c-92fa-1981f0e4ea72",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
@@ -206,144 +206,6 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.chat": {
|
||||
"name": "chat",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"profile1_id": {
|
||||
"name": "profile1_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"profile2_id": {
|
||||
"name": "profile2_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "chat_status",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'active'"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.greetings": {
|
||||
"name": "greetings",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"text": {
|
||||
"name": "text",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.message": {
|
||||
"name": "message",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"chat_id": {
|
||||
"name": "chat_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"text": {
|
||||
"name": "text",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"media_url": {
|
||||
"name": "media_url",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"media_type": {
|
||||
"name": "media_type",
|
||||
"type": "media_type",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"message_chat_id_chat_id_fk": {
|
||||
"name": "message_chat_id_chat_id_fk",
|
||||
"tableFrom": "message",
|
||||
"tableTo": "chat",
|
||||
"columnsFrom": [
|
||||
"chat_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.payment": {
|
||||
"name": "payment",
|
||||
"schema": "",
|
||||
@@ -445,12 +307,6 @@
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"active_chat_id": {
|
||||
"name": "active_chat_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"fcm_token": {
|
||||
"name": "fcm_token",
|
||||
"type": "text",
|
||||
@@ -501,58 +357,6 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.media": {
|
||||
"name": "media",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"path": {
|
||||
"name": "path",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "varchar(10)",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"media_user_id_user_id_fk": {
|
||||
"name": "media_user_id_user_id_fk",
|
||||
"tableFrom": "media",
|
||||
"tableTo": "user",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.profile": {
|
||||
"name": "profile",
|
||||
"schema": "",
|
||||
@@ -582,6 +386,13 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"gender": {
|
||||
"name": "gender",
|
||||
"type": "gender",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"city_id": {
|
||||
"name": "city_id",
|
||||
"type": "uuid",
|
||||
@@ -617,6 +428,12 @@
|
||||
"type": "double precision",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"active_chat_id": {
|
||||
"name": "active_chat_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
@@ -662,15 +479,67 @@
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {
|
||||
"profile_user_id_unique": {
|
||||
"name": "profile_user_id_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
]
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.profile_media": {
|
||||
"name": "profile_media",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"profile_id": {
|
||||
"name": "profile_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"path": {
|
||||
"name": "path",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "profile_media_type",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"sort_order": {
|
||||
"name": "sort_order",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"profile_media_profile_id_profile_id_fk": {
|
||||
"name": "profile_media_profile_id_profile_id_fk",
|
||||
"tableFrom": "profile_media",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"profile_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
@@ -772,14 +641,14 @@
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"source_user": {
|
||||
"name": "source_user",
|
||||
"source_profile_id": {
|
||||
"name": "source_profile_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"target_user": {
|
||||
"name": "target_user",
|
||||
"target_profile_id": {
|
||||
"name": "target_profile_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -801,12 +670,12 @@
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"like_source_user_user_id_fk": {
|
||||
"name": "like_source_user_user_id_fk",
|
||||
"like_source_profile_id_profile_id_fk": {
|
||||
"name": "like_source_profile_id_profile_id_fk",
|
||||
"tableFrom": "like",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"source_user"
|
||||
"source_profile_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -814,12 +683,12 @@
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"like_target_user_user_id_fk": {
|
||||
"name": "like_target_user_user_id_fk",
|
||||
"like_target_profile_id_profile_id_fk": {
|
||||
"name": "like_target_profile_id_profile_id_fk",
|
||||
"tableFrom": "like",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"target_user"
|
||||
"target_profile_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -845,14 +714,14 @@
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"user1_id": {
|
||||
"name": "user1_id",
|
||||
"profile1_id": {
|
||||
"name": "profile1_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"user2_id": {
|
||||
"name": "user2_id",
|
||||
"profile2_id": {
|
||||
"name": "profile2_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -867,12 +736,12 @@
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"match_user1_id_user_id_fk": {
|
||||
"name": "match_user1_id_user_id_fk",
|
||||
"match_profile1_id_profile_id_fk": {
|
||||
"name": "match_profile1_id_profile_id_fk",
|
||||
"tableFrom": "match",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"user1_id"
|
||||
"profile1_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -880,12 +749,190 @@
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"match_user2_id_user_id_fk": {
|
||||
"name": "match_user2_id_user_id_fk",
|
||||
"match_profile2_id_profile_id_fk": {
|
||||
"name": "match_profile2_id_profile_id_fk",
|
||||
"tableFrom": "match",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"user2_id"
|
||||
"profile2_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.chat": {
|
||||
"name": "chat",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"profile1_id": {
|
||||
"name": "profile1_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"profile2_id": {
|
||||
"name": "profile2_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "chat_status",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'active'"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"chat_profile1_id_profile_id_fk": {
|
||||
"name": "chat_profile1_id_profile_id_fk",
|
||||
"tableFrom": "chat",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"profile1_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"chat_profile2_id_profile_id_fk": {
|
||||
"name": "chat_profile2_id_profile_id_fk",
|
||||
"tableFrom": "chat",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"profile2_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.greetings": {
|
||||
"name": "greetings",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"text": {
|
||||
"name": "text",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.message": {
|
||||
"name": "message",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"primaryKey": true,
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"chat_id": {
|
||||
"name": "chat_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"profile_id": {
|
||||
"name": "profile_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"text": {
|
||||
"name": "text",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"media_url": {
|
||||
"name": "media_url",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"media_type": {
|
||||
"name": "media_type",
|
||||
"type": "message_media_type",
|
||||
"typeSchema": "public",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"message_chat_id_chat_id_fk": {
|
||||
"name": "message_chat_id_chat_id_fk",
|
||||
"tableFrom": "message",
|
||||
"tableTo": "chat",
|
||||
"columnsFrom": [
|
||||
"chat_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"message_profile_id_profile_id_fk": {
|
||||
"name": "message_profile_id_profile_id_fk",
|
||||
"tableFrom": "message",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"profile_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -911,14 +958,14 @@
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"user1_id": {
|
||||
"name": "user1_id",
|
||||
"profile1_id": {
|
||||
"name": "profile1_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"user2_id": {
|
||||
"name": "user2_id",
|
||||
"profile2_id": {
|
||||
"name": "profile2_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -950,12 +997,12 @@
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"date_user1_id_user_id_fk": {
|
||||
"name": "date_user1_id_user_id_fk",
|
||||
"date_profile1_id_profile_id_fk": {
|
||||
"name": "date_profile1_id_profile_id_fk",
|
||||
"tableFrom": "date",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"user1_id"
|
||||
"profile1_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -963,12 +1010,12 @@
|
||||
"onDelete": "cascade",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"date_user2_id_user_id_fk": {
|
||||
"name": "date_user2_id_user_id_fk",
|
||||
"date_profile2_id_profile_id_fk": {
|
||||
"name": "date_profile2_id_profile_id_fk",
|
||||
"tableFrom": "date",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"user2_id"
|
||||
"profile2_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -1033,8 +1080,8 @@
|
||||
"notNull": true,
|
||||
"default": "gen_random_uuid()"
|
||||
},
|
||||
"source_user": {
|
||||
"name": "source_user",
|
||||
"source_profile_id": {
|
||||
"name": "source_profile_id",
|
||||
"type": "uuid",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -1061,12 +1108,12 @@
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"report_source_user_user_id_fk": {
|
||||
"name": "report_source_user_user_id_fk",
|
||||
"report_source_profile_id_profile_id_fk": {
|
||||
"name": "report_source_profile_id_profile_id_fk",
|
||||
"tableFrom": "report",
|
||||
"tableTo": "user",
|
||||
"tableTo": "profile",
|
||||
"columnsFrom": [
|
||||
"source_user"
|
||||
"source_profile_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
@@ -1083,23 +1130,6 @@
|
||||
}
|
||||
},
|
||||
"enums": {
|
||||
"public.chat_status": {
|
||||
"name": "chat_status",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"active",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
"public.media_type": {
|
||||
"name": "media_type",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"photo",
|
||||
"voice",
|
||||
"video"
|
||||
]
|
||||
},
|
||||
"public.user_status": {
|
||||
"name": "user_status",
|
||||
"schema": "public",
|
||||
@@ -1109,6 +1139,23 @@
|
||||
"pending"
|
||||
]
|
||||
},
|
||||
"public.gender": {
|
||||
"name": "gender",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"male",
|
||||
"female"
|
||||
]
|
||||
},
|
||||
"public.profile_media_type": {
|
||||
"name": "profile_media_type",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"photo",
|
||||
"video",
|
||||
"audio"
|
||||
]
|
||||
},
|
||||
"public.like_type": {
|
||||
"name": "like_type",
|
||||
"schema": "public",
|
||||
@@ -1117,6 +1164,23 @@
|
||||
"dislike"
|
||||
]
|
||||
},
|
||||
"public.chat_status": {
|
||||
"name": "chat_status",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"active",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
"public.message_media_type": {
|
||||
"name": "message_media_type",
|
||||
"schema": "public",
|
||||
"values": [
|
||||
"photo",
|
||||
"voice",
|
||||
"video"
|
||||
]
|
||||
},
|
||||
"public.report_entity_type": {
|
||||
"name": "report_entity_type",
|
||||
"schema": "public",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,15 +5,8 @@
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "7",
|
||||
"when": 1780401435523,
|
||||
"tag": "0000_romantic_morg",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "7",
|
||||
"when": 1780403477744,
|
||||
"tag": "0001_brown_marrow",
|
||||
"when": 1780405352119,
|
||||
"tag": "0000_quick_silver_samurai",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import { pgEnum, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
|
||||
import { profile } from './profile.schema';
|
||||
|
||||
export const chatStatusEnum = pgEnum('chat_status', ['active', 'closed']);
|
||||
export const mediaTypeEnum = pgEnum('media_type', ['photo', 'voice', 'video']);
|
||||
export const messageMediaTypeEnum = pgEnum('message_media_type', ['photo', 'voice', 'video']);
|
||||
|
||||
export const chat = pgTable('chat', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
profile1Id: uuid('profile1_id').notNull(),
|
||||
profile2Id: uuid('profile2_id').notNull(),
|
||||
profile1Id: uuid('profile1_id')
|
||||
.notNull()
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
profile2Id: uuid('profile2_id')
|
||||
.notNull()
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
status: chatStatusEnum('status').notNull().default('active'),
|
||||
});
|
||||
|
||||
@@ -15,10 +20,12 @@ export const message = pgTable('message', {
|
||||
chatId: uuid('chat_id')
|
||||
.notNull()
|
||||
.references(() => chat.id, { onDelete: 'cascade' }),
|
||||
userId: uuid('user_id').notNull(),
|
||||
profileId: uuid('profile_id')
|
||||
.notNull()
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
text: text('text'),
|
||||
mediaUrl: text('media_url'),
|
||||
mediaType: mediaTypeEnum('media_type'),
|
||||
mediaType: messageMediaTypeEnum('media_type'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { decimal, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
|
||||
import { user } from './user.schema';
|
||||
import { profile } from './profile.schema';
|
||||
|
||||
export const dateStatus = pgTable('date_status', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
@@ -8,12 +8,12 @@ export const dateStatus = pgTable('date_status', {
|
||||
|
||||
export const date = pgTable('date', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
user1Id: uuid('user1_id')
|
||||
profile1Id: uuid('profile1_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
user2Id: uuid('user2_id')
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
profile2Id: uuid('profile2_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
lat: decimal('lat', { precision: 10, scale: 7 }).notNull(),
|
||||
lng: decimal('lng', { precision: 10, scale: 7 }).notNull(),
|
||||
time: timestamp('time', { withTimezone: true }).notNull(),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export * from './role.schema';
|
||||
export * from './tariff.schema';
|
||||
export * from './city.schema';
|
||||
export * from './chat.schema';
|
||||
export * from './user.schema';
|
||||
export * from './profile.schema';
|
||||
export * from './social.schema';
|
||||
export * from './chat.schema';
|
||||
export * from './date.schema';
|
||||
export * from './report.schema';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { date, doublePrecision, pgEnum, pgTable, text, uuid, varchar } from 'drizzle-orm/pg-core';
|
||||
import { date, doublePrecision, integer, pgEnum, pgTable, text, uuid, varchar } from 'drizzle-orm/pg-core';
|
||||
import { user } from './user.schema';
|
||||
import { city, cityDistrict } from './city.schema';
|
||||
|
||||
export const genderEnum = pgEnum('gender', ['male', 'female']);
|
||||
export const profileMediaTypeEnum = pgEnum('profile_media_type', ['photo', 'video', 'audio']);
|
||||
|
||||
export const profile = pgTable('profile', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id')
|
||||
.notNull()
|
||||
.unique()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
name: varchar('name', { length: 100 }).notNull(),
|
||||
birthDate: date('birth_date').notNull(),
|
||||
@@ -19,6 +19,18 @@ export const profile = pgTable('profile', {
|
||||
nation: varchar('nation', { length: 100 }),
|
||||
height: doublePrecision('height'),
|
||||
weight: doublePrecision('weight'),
|
||||
activeChatId: uuid('active_chat_id'),
|
||||
});
|
||||
|
||||
// Media attachments for a profile (photos, videos, audio)
|
||||
export const profileMedia = pgTable('profile_media', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
profileId: uuid('profile_id')
|
||||
.notNull()
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
path: text('path').notNull(),
|
||||
type: profileMediaTypeEnum('type').notNull(),
|
||||
sortOrder: integer('sort_order').notNull().default(0),
|
||||
});
|
||||
|
||||
export const tag = pgTable('tag', {
|
||||
@@ -34,12 +46,3 @@ export const profileTag = pgTable('profile_tag', {
|
||||
.notNull()
|
||||
.references(() => tag.id, { onDelete: 'cascade' }),
|
||||
});
|
||||
|
||||
export const media = pgTable('media', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
path: text('path').notNull(),
|
||||
type: varchar('type', { length: 10 }).notNull(),
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { pgEnum, pgTable, text, uuid } from 'drizzle-orm/pg-core';
|
||||
import { user } from './user.schema';
|
||||
import { profile } from './profile.schema';
|
||||
|
||||
export const reportEntityTypeEnum = pgEnum('report_entity_type', ['profile', 'message']);
|
||||
|
||||
export const report = pgTable('report', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
sourceUser: uuid('source_user')
|
||||
sourceProfileId: uuid('source_profile_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
entityId: uuid('entity_id').notNull(),
|
||||
entityType: reportEntityTypeEnum('entity_type').notNull(),
|
||||
description: text('description'),
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { pgEnum, pgTable, timestamp, uuid } from 'drizzle-orm/pg-core';
|
||||
import { user } from './user.schema';
|
||||
import { profile } from './profile.schema';
|
||||
|
||||
export const likeTypeEnum = pgEnum('like_type', ['like', 'dislike']);
|
||||
|
||||
export const like = pgTable('like', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
sourceUser: uuid('source_user')
|
||||
sourceProfileId: uuid('source_profile_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
targetUser: uuid('target_user')
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
targetProfileId: uuid('target_profile_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
type: likeTypeEnum('type').notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export const match = pgTable('match', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
user1Id: uuid('user1_id')
|
||||
profile1Id: uuid('profile1_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
user2Id: uuid('user2_id')
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
profile2Id: uuid('profile2_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
.references(() => profile.id, { onDelete: 'cascade' }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
@@ -12,7 +12,6 @@ export const user = pgTable('user', {
|
||||
roleId: uuid('role_id').references(() => role.id, { onDelete: 'set null' }),
|
||||
tariffId: uuid('tariff_id').references(() => tariff.id, { onDelete: 'set null' }),
|
||||
paymentId: uuid('payment_id'),
|
||||
activeChatId: uuid('active_chat_id'),
|
||||
fcmToken: text('fcm_token'),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user