@optimatech88/titomeet-shared-lib 1.0.51 โ 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/Readme +142 -0
- package/package.json +4 -4
- package/prisma/migrations/20250528182042_updated_user_model/migration.sql +0 -11
- package/prisma/migrations/20250530152731_updated_model/migration.sql +0 -1
- package/prisma/migrations/20250530152845_updated_model/migration.sql +0 -1
- package/prisma/migrations/20250604094431_added_user_interests/migration.sql +0 -16
- package/prisma/migrations/20250604105002_added_category_children/migration.sql +0 -31
- package/prisma/migrations/20250611180441_added_chat_files/migration.sql +0 -11
- package/prisma/migrations/20250617111807_updated_notification_type/migration.sql +0 -13
- package/prisma/migrations/20250716081532_added_newslettter/migration.sql +0 -13
- package/prisma/migrations/20250805002500_added_provider_on_event/migration.sql +0 -433
- package/prisma/migrations/20250805005727_added_status/migration.sql +0 -5
- package/prisma/migrations/20250805131004_added_pricing/migration.sql +0 -43
- package/prisma/migrations/20250805131431_added_expiration_time/migration.sql +0 -2
- package/prisma/migrations/20250805132756_added_ref/migration.sql +0 -2
- package/prisma/migrations/20250805145538_added_title/migration.sql +0 -12
- package/prisma/migrations/20250805145659_added_active/migration.sql +0 -2
- package/prisma/migrations/20250813221037_added_parent/migration.sql +0 -5
- package/prisma/migrations/20250814113100_added_ticker_seats/migration.sql +0 -2
- package/prisma/migrations/20250814113912_added_remaining_seats/migration.sql +0 -2
- package/prisma/migrations/20250822091756_updated_feedback/migration.sql +0 -16
- package/prisma/migrations/20250908103849_added_account_type/migration.sql +0 -6
- package/prisma/migrations/20251013165256_add_type_to_event_model/migration.sql +0 -7
- package/prisma/migrations/migration_lock.toml +0 -3
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DATABASE_URL="postgresql://postgres:demo@localhost:5433/titomeet?schema=public"
|
package/Readme
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @optimatech88/titomeet-shared-lib
|
|
2
|
+
|
|
3
|
+
A shared library designed to centralize the **Prisma schema**, **database models**, and **common NestJS utilities** used across microservices in the Titomeet ecosystem. This ensures consistent data structure and logic reuse between backend services.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ฆ Features
|
|
8
|
+
|
|
9
|
+
* Centralized **Prisma schema**
|
|
10
|
+
* Shared **NestJS modules & services** (e.g. auth utilities, helpers)
|
|
11
|
+
* Built-in **Seeder utilities** using `nestjs-seeder`
|
|
12
|
+
* Ships with TypeScript and supports Prisma generation
|
|
13
|
+
* Ready-to-integrate with any NestJS microservice
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## ๐ Installation
|
|
18
|
+
|
|
19
|
+
Install the shared library in your microservice project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn add @optimatech88/titomeet-shared-lib
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
*or*
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @optimatech88/titomeet-shared-lib
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## โ๏ธ Usage
|
|
34
|
+
|
|
35
|
+
### 1. Configure Prisma to use the shared schema
|
|
36
|
+
|
|
37
|
+
In your consuming service's `package.json`, add:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"prisma": {
|
|
42
|
+
"schema": "node_modules/@optimatech88/titomeet-shared-lib/prisma/schema.prisma"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### 2. Generate Prisma Client
|
|
50
|
+
|
|
51
|
+
After installation or updates, run:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx prisma generate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This will generate the Prisma Client in your consuming service's `node_modules/@prisma/client` based on the shared schema.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 3. Import Shared Services or Prisma Client
|
|
62
|
+
|
|
63
|
+
Example usage in a NestJS app:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { PrismaService } from '@optimatech88/titomeet-shared-lib';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You can also import other shared services, modules, helpers, and types from this library.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## ๐งช Development
|
|
74
|
+
|
|
75
|
+
To contribute or update the library:
|
|
76
|
+
|
|
77
|
+
1. Install dependencies:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
yarn install
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. Make changes to the Prisma schema or NestJS modules.
|
|
84
|
+
|
|
85
|
+
3. To create a new migration and update your local dev database:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run migrate:dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
4. Generate Prisma Client:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run generate
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
5. Build the library:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm run build
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## ๐ฆ Publishing
|
|
106
|
+
|
|
107
|
+
Before publishing a new version:
|
|
108
|
+
|
|
109
|
+
1. Bump the package version:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm version patch # or minor/major
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
2. Publish to npm:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm publish
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The `prepare` script will ensure Prisma and the build are up-to-date before publishing.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## โ ๏ธ Important Notes
|
|
126
|
+
|
|
127
|
+
* **Only one microservice should run migrations in production**. Others should sync using `prisma generate`.
|
|
128
|
+
* Avoid using `prisma db push` in production environments.
|
|
129
|
+
* Use `prisma migrate dev` for evolving your schema and developing locally.
|
|
130
|
+
* Always regenerate Prisma client in consuming services after package updates.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## ๐ License
|
|
135
|
+
|
|
136
|
+
ISC
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## โจ Author
|
|
141
|
+
|
|
142
|
+
Built with โค๏ธ by the OptimaTech Team
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optimatech88/titomeet-shared-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
8
|
"build": "nest build",
|
|
9
9
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
10
|
-
"generate": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"generate": "prisma generate",
|
|
11
|
+
"migrate:dev": "prisma migrate dev",
|
|
12
|
+
"prepare": "npm run generate && npm run build"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "UserStatus" AS ENUM ('ACTIVE', 'INACTIVE', 'DELETED');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "MediaType" AS ENUM ('image', 'video', 'audio', 'pdf');
|
|
6
|
-
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE "Message" ADD COLUMN "mediaType" "MediaType";
|
|
9
|
-
|
|
10
|
-
-- AlterTable
|
|
11
|
-
ALTER TABLE "User" ADD COLUMN "status" "UserStatus" NOT NULL DEFAULT 'ACTIVE';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "UserInterests" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"interests" TEXT[],
|
|
5
|
-
"userId" TEXT NOT NULL,
|
|
6
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
7
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
8
|
-
|
|
9
|
-
CONSTRAINT "UserInterests_pkey" PRIMARY KEY ("id")
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
-- CreateIndex
|
|
13
|
-
CREATE UNIQUE INDEX "UserInterests_userId_key" ON "UserInterests"("userId");
|
|
14
|
-
|
|
15
|
-
-- AddForeignKey
|
|
16
|
-
ALTER TABLE "UserInterests" ADD CONSTRAINT "UserInterests_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to drop the column `interests` on the `UserInterests` table. All the data in the column will be lost.
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE "EventCategory" ADD COLUMN "parentId" TEXT;
|
|
9
|
-
|
|
10
|
-
-- AlterTable
|
|
11
|
-
ALTER TABLE "UserInterests" DROP COLUMN "interests";
|
|
12
|
-
|
|
13
|
-
-- CreateTable
|
|
14
|
-
CREATE TABLE "_EventCategoryToUserInterests" (
|
|
15
|
-
"A" TEXT NOT NULL,
|
|
16
|
-
"B" TEXT NOT NULL,
|
|
17
|
-
|
|
18
|
-
CONSTRAINT "_EventCategoryToUserInterests_AB_pkey" PRIMARY KEY ("A","B")
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
-- CreateIndex
|
|
22
|
-
CREATE INDEX "_EventCategoryToUserInterests_B_index" ON "_EventCategoryToUserInterests"("B");
|
|
23
|
-
|
|
24
|
-
-- AddForeignKey
|
|
25
|
-
ALTER TABLE "EventCategory" ADD CONSTRAINT "EventCategory_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "EventCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
26
|
-
|
|
27
|
-
-- AddForeignKey
|
|
28
|
-
ALTER TABLE "_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_A_fkey" FOREIGN KEY ("A") REFERENCES "EventCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
29
|
-
|
|
30
|
-
-- AddForeignKey
|
|
31
|
-
ALTER TABLE "_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_B_fkey" FOREIGN KEY ("B") REFERENCES "UserInterests"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to drop the column `mediaType` on the `Message` table. All the data in the column will be lost.
|
|
5
|
-
- You are about to drop the column `mediaUrl` on the `Message` table. All the data in the column will be lost.
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
-- AlterTable
|
|
9
|
-
ALTER TABLE "Message" DROP COLUMN "mediaType",
|
|
10
|
-
DROP COLUMN "mediaUrl",
|
|
11
|
-
ADD COLUMN "files" JSONB;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
-- AlterEnum
|
|
2
|
-
-- This migration adds more than one value to an enum.
|
|
3
|
-
-- With PostgreSQL versions 11 and earlier, this is not possible
|
|
4
|
-
-- in a single migration. This can be worked around by creating
|
|
5
|
-
-- multiple migrations, each migration adding only one value to
|
|
6
|
-
-- the enum.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ALTER TYPE "NotificationType" ADD VALUE 'EVENT_VALIDATION';
|
|
10
|
-
ALTER TYPE "NotificationType" ADD VALUE 'EVENT_REJECTION';
|
|
11
|
-
ALTER TYPE "NotificationType" ADD VALUE 'EVENT_ASSIGNMENT';
|
|
12
|
-
ALTER TYPE "NotificationType" ADD VALUE 'EVENT_ASSIGNMENT_APPROVAL';
|
|
13
|
-
ALTER TYPE "NotificationType" ADD VALUE 'EVENT_ASSIGNMENT_REJECTION';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "Newsletter" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"email" TEXT NOT NULL,
|
|
5
|
-
"unsubscribedAt" TIMESTAMP(3),
|
|
6
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
7
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
8
|
-
|
|
9
|
-
CONSTRAINT "Newsletter_pkey" PRIMARY KEY ("id")
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
-- CreateIndex
|
|
13
|
-
CREATE UNIQUE INDEX "Newsletter_email_key" ON "Newsletter"("email");
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "public"."UserRole" AS ENUM ('SUPER_ADMIN', 'ADMIN', 'USER');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "public"."UserStatus" AS ENUM ('ACTIVE', 'INACTIVE', 'DELETED');
|
|
6
|
-
|
|
7
|
-
-- CreateEnum
|
|
8
|
-
CREATE TYPE "public"."EventAccess" AS ENUM ('FREE', 'PAID');
|
|
9
|
-
|
|
10
|
-
-- CreateEnum
|
|
11
|
-
CREATE TYPE "public"."EventVisibility" AS ENUM ('PUBLIC', 'PRIVATE');
|
|
12
|
-
|
|
13
|
-
-- CreateEnum
|
|
14
|
-
CREATE TYPE "public"."EventStatus" AS ENUM ('DRAFT', 'PUBLISHED', 'PENDING', 'CANCELLED');
|
|
15
|
-
|
|
16
|
-
-- CreateEnum
|
|
17
|
-
CREATE TYPE "public"."MediaType" AS ENUM ('image', 'video', 'audio', 'pdf');
|
|
18
|
-
|
|
19
|
-
-- CreateEnum
|
|
20
|
-
CREATE TYPE "public"."NotificationType" AS ENUM ('NEW_MESSAGE', 'EVENT_REMINDER', 'EVENT_PARTICIPATION_CONFIRMATION', 'EVENT_VALIDATION', 'EVENT_REJECTION', 'EVENT_ASSIGNMENT', 'EVENT_ASSIGNMENT_APPROVAL', 'EVENT_ASSIGNMENT_REJECTION');
|
|
21
|
-
|
|
22
|
-
-- CreateEnum
|
|
23
|
-
CREATE TYPE "public"."ProviderStatus" AS ENUM ('PENDING', 'APPROVED', 'REJECTED');
|
|
24
|
-
|
|
25
|
-
-- CreateEnum
|
|
26
|
-
CREATE TYPE "public"."OrderStatus" AS ENUM ('PENDING', 'CONFIRMED', 'CANCELLED', 'REFUNDED');
|
|
27
|
-
|
|
28
|
-
-- CreateEnum
|
|
29
|
-
CREATE TYPE "public"."PaymentStatus" AS ENUM ('PENDING', 'COMPLETED', 'FAILED', 'REFUNDED');
|
|
30
|
-
|
|
31
|
-
-- CreateTable
|
|
32
|
-
CREATE TABLE "public"."User" (
|
|
33
|
-
"id" TEXT NOT NULL,
|
|
34
|
-
"username" TEXT NOT NULL,
|
|
35
|
-
"email" TEXT NOT NULL,
|
|
36
|
-
"firstName" TEXT NOT NULL,
|
|
37
|
-
"lastName" TEXT NOT NULL,
|
|
38
|
-
"password" TEXT,
|
|
39
|
-
"role" "public"."UserRole" NOT NULL DEFAULT 'USER',
|
|
40
|
-
"profilePicture" TEXT,
|
|
41
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
42
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
43
|
-
"emailVerified" BOOLEAN NOT NULL DEFAULT false,
|
|
44
|
-
"status" "public"."UserStatus" NOT NULL DEFAULT 'ACTIVE',
|
|
45
|
-
|
|
46
|
-
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
-- CreateTable
|
|
50
|
-
CREATE TABLE "public"."Account" (
|
|
51
|
-
"id" TEXT NOT NULL,
|
|
52
|
-
"refreshToken" TEXT NOT NULL,
|
|
53
|
-
"expiresAt" TIMESTAMP(3) NOT NULL,
|
|
54
|
-
"userId" TEXT NOT NULL,
|
|
55
|
-
|
|
56
|
-
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
-- CreateTable
|
|
60
|
-
CREATE TABLE "public"."Address" (
|
|
61
|
-
"id" TEXT NOT NULL,
|
|
62
|
-
"name" TEXT NOT NULL,
|
|
63
|
-
"line2" TEXT,
|
|
64
|
-
"city" TEXT,
|
|
65
|
-
"state" TEXT,
|
|
66
|
-
"country" TEXT NOT NULL,
|
|
67
|
-
"postalCode" TEXT,
|
|
68
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
69
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
70
|
-
"countryCode" TEXT,
|
|
71
|
-
"latitude" DOUBLE PRECISION,
|
|
72
|
-
"longitude" DOUBLE PRECISION,
|
|
73
|
-
"type" TEXT NOT NULL DEFAULT 'suburb',
|
|
74
|
-
|
|
75
|
-
CONSTRAINT "Address_pkey" PRIMARY KEY ("id")
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
-- CreateTable
|
|
79
|
-
CREATE TABLE "public"."EventCategory" (
|
|
80
|
-
"id" TEXT NOT NULL,
|
|
81
|
-
"name" TEXT NOT NULL,
|
|
82
|
-
"description" TEXT,
|
|
83
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
84
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
85
|
-
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
86
|
-
"parentId" TEXT,
|
|
87
|
-
|
|
88
|
-
CONSTRAINT "EventCategory_pkey" PRIMARY KEY ("id")
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
-- CreateTable
|
|
92
|
-
CREATE TABLE "public"."Event" (
|
|
93
|
-
"id" TEXT NOT NULL,
|
|
94
|
-
"name" TEXT NOT NULL,
|
|
95
|
-
"description" TEXT NOT NULL,
|
|
96
|
-
"startDate" TIMESTAMP(3) NOT NULL,
|
|
97
|
-
"endDate" TIMESTAMP(3) NOT NULL,
|
|
98
|
-
"startTime" TEXT NOT NULL,
|
|
99
|
-
"endTime" TEXT NOT NULL,
|
|
100
|
-
"capacity" INTEGER NOT NULL,
|
|
101
|
-
"coverPicture" TEXT NOT NULL,
|
|
102
|
-
"badge" TEXT NOT NULL,
|
|
103
|
-
"tags" TEXT[],
|
|
104
|
-
"accessType" "public"."EventAccess" NOT NULL DEFAULT 'FREE',
|
|
105
|
-
"visibility" "public"."EventVisibility" NOT NULL DEFAULT 'PUBLIC',
|
|
106
|
-
"status" "public"."EventStatus" NOT NULL DEFAULT 'DRAFT',
|
|
107
|
-
"addressId" TEXT NOT NULL,
|
|
108
|
-
"postedById" TEXT NOT NULL,
|
|
109
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
110
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
111
|
-
|
|
112
|
-
CONSTRAINT "Event_pkey" PRIMARY KEY ("id")
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
-- CreateTable
|
|
116
|
-
CREATE TABLE "public"."EventPrice" (
|
|
117
|
-
"id" TEXT NOT NULL,
|
|
118
|
-
"name" TEXT NOT NULL,
|
|
119
|
-
"amount" DOUBLE PRECISION NOT NULL,
|
|
120
|
-
"description" TEXT,
|
|
121
|
-
"eventId" TEXT NOT NULL,
|
|
122
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
123
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
124
|
-
|
|
125
|
-
CONSTRAINT "EventPrice_pkey" PRIMARY KEY ("id")
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
-- CreateTable
|
|
129
|
-
CREATE TABLE "public"."Chat" (
|
|
130
|
-
"id" TEXT NOT NULL,
|
|
131
|
-
"name" TEXT NOT NULL,
|
|
132
|
-
"eventId" TEXT NOT NULL,
|
|
133
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
134
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
135
|
-
|
|
136
|
-
CONSTRAINT "Chat_pkey" PRIMARY KEY ("id")
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
-- CreateTable
|
|
140
|
-
CREATE TABLE "public"."ChatUser" (
|
|
141
|
-
"id" TEXT NOT NULL,
|
|
142
|
-
"chatId" TEXT NOT NULL,
|
|
143
|
-
"userId" TEXT NOT NULL,
|
|
144
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
145
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
146
|
-
|
|
147
|
-
CONSTRAINT "ChatUser_pkey" PRIMARY KEY ("id")
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
-- CreateTable
|
|
151
|
-
CREATE TABLE "public"."Message" (
|
|
152
|
-
"id" TEXT NOT NULL,
|
|
153
|
-
"chatId" TEXT NOT NULL,
|
|
154
|
-
"senderId" TEXT NOT NULL,
|
|
155
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
156
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
157
|
-
"files" JSONB,
|
|
158
|
-
"text" TEXT NOT NULL,
|
|
159
|
-
|
|
160
|
-
CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
-- CreateTable
|
|
164
|
-
CREATE TABLE "public"."Notification" (
|
|
165
|
-
"id" TEXT NOT NULL,
|
|
166
|
-
"notifiedToId" TEXT NOT NULL,
|
|
167
|
-
"userId" TEXT,
|
|
168
|
-
"type" "public"."NotificationType" NOT NULL,
|
|
169
|
-
"read" BOOLEAN NOT NULL DEFAULT false,
|
|
170
|
-
"data" JSONB,
|
|
171
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
172
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
173
|
-
|
|
174
|
-
CONSTRAINT "Notification_pkey" PRIMARY KEY ("id")
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
-- CreateTable
|
|
178
|
-
CREATE TABLE "public"."ProviderCategory" (
|
|
179
|
-
"id" TEXT NOT NULL,
|
|
180
|
-
"name" TEXT NOT NULL,
|
|
181
|
-
"description" TEXT,
|
|
182
|
-
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
183
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
184
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
185
|
-
|
|
186
|
-
CONSTRAINT "ProviderCategory_pkey" PRIMARY KEY ("id")
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
-- CreateTable
|
|
190
|
-
CREATE TABLE "public"."Provider" (
|
|
191
|
-
"id" TEXT NOT NULL,
|
|
192
|
-
"name" TEXT NOT NULL,
|
|
193
|
-
"description" TEXT,
|
|
194
|
-
"image" TEXT,
|
|
195
|
-
"userId" TEXT NOT NULL,
|
|
196
|
-
"status" "public"."ProviderStatus" NOT NULL DEFAULT 'PENDING',
|
|
197
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
198
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
199
|
-
"addressId" TEXT,
|
|
200
|
-
"categoryId" TEXT NOT NULL,
|
|
201
|
-
"docs" JSONB,
|
|
202
|
-
"email" TEXT,
|
|
203
|
-
"phoneNumber" TEXT,
|
|
204
|
-
"pricingDetails" TEXT,
|
|
205
|
-
"rating" DOUBLE PRECISION,
|
|
206
|
-
"website" TEXT,
|
|
207
|
-
|
|
208
|
-
CONSTRAINT "Provider_pkey" PRIMARY KEY ("id")
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
-- CreateTable
|
|
212
|
-
CREATE TABLE "public"."ProviderOnEvent" (
|
|
213
|
-
"id" TEXT NOT NULL,
|
|
214
|
-
"providerId" TEXT NOT NULL,
|
|
215
|
-
"eventId" TEXT NOT NULL,
|
|
216
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
217
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
218
|
-
|
|
219
|
-
CONSTRAINT "ProviderOnEvent_pkey" PRIMARY KEY ("id")
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
-- CreateTable
|
|
223
|
-
CREATE TABLE "public"."Review" (
|
|
224
|
-
"id" TEXT NOT NULL,
|
|
225
|
-
"rating" DOUBLE PRECISION NOT NULL,
|
|
226
|
-
"comment" TEXT,
|
|
227
|
-
"providerId" TEXT NOT NULL,
|
|
228
|
-
"userId" TEXT NOT NULL,
|
|
229
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
230
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
231
|
-
|
|
232
|
-
CONSTRAINT "Review_pkey" PRIMARY KEY ("id")
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
-- CreateTable
|
|
236
|
-
CREATE TABLE "public"."Favorite" (
|
|
237
|
-
"id" TEXT NOT NULL,
|
|
238
|
-
"userId" TEXT NOT NULL,
|
|
239
|
-
"eventId" TEXT NOT NULL,
|
|
240
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
241
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
242
|
-
|
|
243
|
-
CONSTRAINT "Favorite_pkey" PRIMARY KEY ("id")
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
-- CreateTable
|
|
247
|
-
CREATE TABLE "public"."Order" (
|
|
248
|
-
"id" TEXT NOT NULL,
|
|
249
|
-
"userId" TEXT NOT NULL,
|
|
250
|
-
"eventId" TEXT NOT NULL,
|
|
251
|
-
"email" TEXT NOT NULL,
|
|
252
|
-
"status" "public"."OrderStatus" NOT NULL DEFAULT 'PENDING',
|
|
253
|
-
"totalAmount" DOUBLE PRECISION NOT NULL,
|
|
254
|
-
"paymentIntentId" TEXT,
|
|
255
|
-
"paymentStatus" "public"."PaymentStatus" NOT NULL DEFAULT 'PENDING',
|
|
256
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
257
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
258
|
-
|
|
259
|
-
CONSTRAINT "Order_pkey" PRIMARY KEY ("id")
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
-- CreateTable
|
|
263
|
-
CREATE TABLE "public"."OrderItem" (
|
|
264
|
-
"id" TEXT NOT NULL,
|
|
265
|
-
"orderId" TEXT NOT NULL,
|
|
266
|
-
"eventPriceId" TEXT NOT NULL,
|
|
267
|
-
"quantity" INTEGER NOT NULL,
|
|
268
|
-
"unitPrice" DOUBLE PRECISION NOT NULL,
|
|
269
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
270
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
271
|
-
|
|
272
|
-
CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id")
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
-- CreateTable
|
|
276
|
-
CREATE TABLE "public"."UserInterests" (
|
|
277
|
-
"id" TEXT NOT NULL,
|
|
278
|
-
"userId" TEXT NOT NULL,
|
|
279
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
280
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
281
|
-
|
|
282
|
-
CONSTRAINT "UserInterests_pkey" PRIMARY KEY ("id")
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
-- CreateTable
|
|
286
|
-
CREATE TABLE "public"."Newsletter" (
|
|
287
|
-
"id" TEXT NOT NULL,
|
|
288
|
-
"email" TEXT NOT NULL,
|
|
289
|
-
"unsubscribedAt" TIMESTAMP(3),
|
|
290
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
291
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
292
|
-
|
|
293
|
-
CONSTRAINT "Newsletter_pkey" PRIMARY KEY ("id")
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
-- CreateTable
|
|
297
|
-
CREATE TABLE "public"."_EventCategoryToUserInterests" (
|
|
298
|
-
"A" TEXT NOT NULL,
|
|
299
|
-
"B" TEXT NOT NULL,
|
|
300
|
-
|
|
301
|
-
CONSTRAINT "_EventCategoryToUserInterests_AB_pkey" PRIMARY KEY ("A","B")
|
|
302
|
-
);
|
|
303
|
-
|
|
304
|
-
-- CreateTable
|
|
305
|
-
CREATE TABLE "public"."_EventToEventCategory" (
|
|
306
|
-
"A" TEXT NOT NULL,
|
|
307
|
-
"B" TEXT NOT NULL,
|
|
308
|
-
|
|
309
|
-
CONSTRAINT "_EventToEventCategory_AB_pkey" PRIMARY KEY ("A","B")
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
-- CreateIndex
|
|
313
|
-
CREATE UNIQUE INDEX "User_username_key" ON "public"."User"("username");
|
|
314
|
-
|
|
315
|
-
-- CreateIndex
|
|
316
|
-
CREATE UNIQUE INDEX "User_email_key" ON "public"."User"("email");
|
|
317
|
-
|
|
318
|
-
-- CreateIndex
|
|
319
|
-
CREATE UNIQUE INDEX "Account_refreshToken_key" ON "public"."Account"("refreshToken");
|
|
320
|
-
|
|
321
|
-
-- CreateIndex
|
|
322
|
-
CREATE UNIQUE INDEX "EventCategory_name_key" ON "public"."EventCategory"("name");
|
|
323
|
-
|
|
324
|
-
-- CreateIndex
|
|
325
|
-
CREATE UNIQUE INDEX "Chat_eventId_key" ON "public"."Chat"("eventId");
|
|
326
|
-
|
|
327
|
-
-- CreateIndex
|
|
328
|
-
CREATE UNIQUE INDEX "ProviderCategory_name_key" ON "public"."ProviderCategory"("name");
|
|
329
|
-
|
|
330
|
-
-- CreateIndex
|
|
331
|
-
CREATE UNIQUE INDEX "Order_paymentIntentId_key" ON "public"."Order"("paymentIntentId");
|
|
332
|
-
|
|
333
|
-
-- CreateIndex
|
|
334
|
-
CREATE UNIQUE INDEX "UserInterests_userId_key" ON "public"."UserInterests"("userId");
|
|
335
|
-
|
|
336
|
-
-- CreateIndex
|
|
337
|
-
CREATE UNIQUE INDEX "Newsletter_email_key" ON "public"."Newsletter"("email");
|
|
338
|
-
|
|
339
|
-
-- CreateIndex
|
|
340
|
-
CREATE INDEX "_EventCategoryToUserInterests_B_index" ON "public"."_EventCategoryToUserInterests"("B");
|
|
341
|
-
|
|
342
|
-
-- CreateIndex
|
|
343
|
-
CREATE INDEX "_EventToEventCategory_B_index" ON "public"."_EventToEventCategory"("B");
|
|
344
|
-
|
|
345
|
-
-- AddForeignKey
|
|
346
|
-
ALTER TABLE "public"."Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
347
|
-
|
|
348
|
-
-- AddForeignKey
|
|
349
|
-
ALTER TABLE "public"."EventCategory" ADD CONSTRAINT "EventCategory_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "public"."EventCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
350
|
-
|
|
351
|
-
-- AddForeignKey
|
|
352
|
-
ALTER TABLE "public"."Event" ADD CONSTRAINT "Event_addressId_fkey" FOREIGN KEY ("addressId") REFERENCES "public"."Address"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
353
|
-
|
|
354
|
-
-- AddForeignKey
|
|
355
|
-
ALTER TABLE "public"."Event" ADD CONSTRAINT "Event_postedById_fkey" FOREIGN KEY ("postedById") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
356
|
-
|
|
357
|
-
-- AddForeignKey
|
|
358
|
-
ALTER TABLE "public"."EventPrice" ADD CONSTRAINT "EventPrice_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
359
|
-
|
|
360
|
-
-- AddForeignKey
|
|
361
|
-
ALTER TABLE "public"."Chat" ADD CONSTRAINT "Chat_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
362
|
-
|
|
363
|
-
-- AddForeignKey
|
|
364
|
-
ALTER TABLE "public"."ChatUser" ADD CONSTRAINT "ChatUser_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "public"."Chat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
365
|
-
|
|
366
|
-
-- AddForeignKey
|
|
367
|
-
ALTER TABLE "public"."ChatUser" ADD CONSTRAINT "ChatUser_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
368
|
-
|
|
369
|
-
-- AddForeignKey
|
|
370
|
-
ALTER TABLE "public"."Message" ADD CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "public"."Chat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
371
|
-
|
|
372
|
-
-- AddForeignKey
|
|
373
|
-
ALTER TABLE "public"."Message" ADD CONSTRAINT "Message_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
374
|
-
|
|
375
|
-
-- AddForeignKey
|
|
376
|
-
ALTER TABLE "public"."Notification" ADD CONSTRAINT "Notification_notifiedToId_fkey" FOREIGN KEY ("notifiedToId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
377
|
-
|
|
378
|
-
-- AddForeignKey
|
|
379
|
-
ALTER TABLE "public"."Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
380
|
-
|
|
381
|
-
-- AddForeignKey
|
|
382
|
-
ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_addressId_fkey" FOREIGN KEY ("addressId") REFERENCES "public"."Address"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
383
|
-
|
|
384
|
-
-- AddForeignKey
|
|
385
|
-
ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "public"."ProviderCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
386
|
-
|
|
387
|
-
-- AddForeignKey
|
|
388
|
-
ALTER TABLE "public"."Provider" ADD CONSTRAINT "Provider_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
389
|
-
|
|
390
|
-
-- AddForeignKey
|
|
391
|
-
ALTER TABLE "public"."ProviderOnEvent" ADD CONSTRAINT "ProviderOnEvent_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "public"."Provider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
392
|
-
|
|
393
|
-
-- AddForeignKey
|
|
394
|
-
ALTER TABLE "public"."ProviderOnEvent" ADD CONSTRAINT "ProviderOnEvent_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
395
|
-
|
|
396
|
-
-- AddForeignKey
|
|
397
|
-
ALTER TABLE "public"."Review" ADD CONSTRAINT "Review_providerId_fkey" FOREIGN KEY ("providerId") REFERENCES "public"."Provider"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
398
|
-
|
|
399
|
-
-- AddForeignKey
|
|
400
|
-
ALTER TABLE "public"."Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
401
|
-
|
|
402
|
-
-- AddForeignKey
|
|
403
|
-
ALTER TABLE "public"."Favorite" ADD CONSTRAINT "Favorite_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
404
|
-
|
|
405
|
-
-- AddForeignKey
|
|
406
|
-
ALTER TABLE "public"."Favorite" ADD CONSTRAINT "Favorite_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
407
|
-
|
|
408
|
-
-- AddForeignKey
|
|
409
|
-
ALTER TABLE "public"."Order" ADD CONSTRAINT "Order_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "public"."Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
410
|
-
|
|
411
|
-
-- AddForeignKey
|
|
412
|
-
ALTER TABLE "public"."Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
413
|
-
|
|
414
|
-
-- AddForeignKey
|
|
415
|
-
ALTER TABLE "public"."OrderItem" ADD CONSTRAINT "OrderItem_eventPriceId_fkey" FOREIGN KEY ("eventPriceId") REFERENCES "public"."EventPrice"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
416
|
-
|
|
417
|
-
-- AddForeignKey
|
|
418
|
-
ALTER TABLE "public"."OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "public"."Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
419
|
-
|
|
420
|
-
-- AddForeignKey
|
|
421
|
-
ALTER TABLE "public"."UserInterests" ADD CONSTRAINT "UserInterests_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
422
|
-
|
|
423
|
-
-- AddForeignKey
|
|
424
|
-
ALTER TABLE "public"."_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_A_fkey" FOREIGN KEY ("A") REFERENCES "public"."EventCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
425
|
-
|
|
426
|
-
-- AddForeignKey
|
|
427
|
-
ALTER TABLE "public"."_EventCategoryToUserInterests" ADD CONSTRAINT "_EventCategoryToUserInterests_B_fkey" FOREIGN KEY ("B") REFERENCES "public"."UserInterests"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
428
|
-
|
|
429
|
-
-- AddForeignKey
|
|
430
|
-
ALTER TABLE "public"."_EventToEventCategory" ADD CONSTRAINT "_EventToEventCategory_A_fkey" FOREIGN KEY ("A") REFERENCES "public"."Event"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
431
|
-
|
|
432
|
-
-- AddForeignKey
|
|
433
|
-
ALTER TABLE "public"."_EventToEventCategory" ADD CONSTRAINT "_EventToEventCategory_B_fkey" FOREIGN KEY ("B") REFERENCES "public"."EventCategory"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "public"."PricingType" AS ENUM ('EVENT_CREATOR', 'PROVIDER');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "public"."PricingDuration" AS ENUM ('WEEKLY', 'BI_WEEKLY', 'MONTHLY', 'YEARLY');
|
|
6
|
-
|
|
7
|
-
-- CreateEnum
|
|
8
|
-
CREATE TYPE "public"."PaymentMethod" AS ENUM ('MOBILE_MONEY');
|
|
9
|
-
|
|
10
|
-
-- CreateEnum
|
|
11
|
-
CREATE TYPE "public"."TransactionStatus" AS ENUM ('PENDING', 'COMPLETED', 'FAILED');
|
|
12
|
-
|
|
13
|
-
-- CreateTable
|
|
14
|
-
CREATE TABLE "public"."Pricing" (
|
|
15
|
-
"id" TEXT NOT NULL,
|
|
16
|
-
"type" "public"."PricingType" NOT NULL DEFAULT 'EVENT_CREATOR',
|
|
17
|
-
"duration" "public"."PricingDuration" NOT NULL DEFAULT 'MONTHLY',
|
|
18
|
-
"amount" DOUBLE PRECISION NOT NULL,
|
|
19
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
21
|
-
|
|
22
|
-
CONSTRAINT "Pricing_pkey" PRIMARY KEY ("id")
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
-- CreateTable
|
|
26
|
-
CREATE TABLE "public"."Transaction" (
|
|
27
|
-
"id" TEXT NOT NULL,
|
|
28
|
-
"amount" DOUBLE PRECISION NOT NULL,
|
|
29
|
-
"paymentMethod" "public"."PaymentMethod" NOT NULL DEFAULT 'MOBILE_MONEY',
|
|
30
|
-
"pricingId" TEXT,
|
|
31
|
-
"userId" TEXT NOT NULL,
|
|
32
|
-
"status" "public"."TransactionStatus" NOT NULL DEFAULT 'PENDING',
|
|
33
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
34
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
35
|
-
|
|
36
|
-
CONSTRAINT "Transaction_pkey" PRIMARY KEY ("id")
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
-- AddForeignKey
|
|
40
|
-
ALTER TABLE "public"."Transaction" ADD CONSTRAINT "Transaction_pricingId_fkey" FOREIGN KEY ("pricingId") REFERENCES "public"."Pricing"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
41
|
-
|
|
42
|
-
-- AddForeignKey
|
|
43
|
-
ALTER TABLE "public"."Transaction" ADD CONSTRAINT "Transaction_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- Added the required column `subtitle` to the `Pricing` table without a default value. This is not possible if the table is not empty.
|
|
5
|
-
- Added the required column `title` to the `Pricing` table without a default value. This is not possible if the table is not empty.
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
-- AlterTable
|
|
9
|
-
ALTER TABLE "public"."Pricing" ADD COLUMN "features" TEXT[],
|
|
10
|
-
ADD COLUMN "priceSuffix" TEXT,
|
|
11
|
-
ADD COLUMN "subtitle" TEXT NOT NULL,
|
|
12
|
-
ADD COLUMN "title" TEXT NOT NULL;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE "public"."ProviderCategory" ADD COLUMN "parentId" TEXT;
|
|
3
|
-
|
|
4
|
-
-- AddForeignKey
|
|
5
|
-
ALTER TABLE "public"."ProviderCategory" ADD CONSTRAINT "ProviderCategory_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "public"."ProviderCategory"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "public"."Feedback" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"category" TEXT NOT NULL,
|
|
5
|
-
"rating" INTEGER NOT NULL,
|
|
6
|
-
"comment" TEXT NOT NULL,
|
|
7
|
-
"email" TEXT,
|
|
8
|
-
"userId" TEXT,
|
|
9
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
11
|
-
|
|
12
|
-
CONSTRAINT "Feedback_pkey" PRIMARY KEY ("id")
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
-- AddForeignKey
|
|
16
|
-
ALTER TABLE "public"."Feedback" ADD CONSTRAINT "Feedback_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|