update admin user business
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` ADD COLUMN `licenseQuota` INTEGER NULL DEFAULT 0;
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `licenseQuota` on the `partners` table. All the data in the column will be lost.
|
||||
- Added the required column `updated_at` to the `accounts` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `business_activities` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `complexes` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `guilds` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `providers` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `updated_at` to the `users` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `accounts` ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL,
|
||||
MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `business_activities` ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL,
|
||||
MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `complexes` ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `device_brands` MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `devices` MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `guilds` ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` DROP COLUMN `licenseQuota`,
|
||||
ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
ADD COLUMN `license_quota` INTEGER NULL DEFAULT 0,
|
||||
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `providers` ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `users` ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL,
|
||||
MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[user_id,business_id]` on the table `accounts` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[user_id,provider_id]` on the table `accounts` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[user_id,pos_id]` on the table `accounts` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `name` to the `poses` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` ADD COLUMN `name` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `accounts_user_id_business_id_key` ON `accounts`(`user_id`, `business_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `accounts_user_id_provider_id_key` ON `accounts`(`user_id`, `provider_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `accounts_user_id_pos_id_key` ON `accounts`(`user_id`, `pos_id`);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `poses` DROP FOREIGN KEY `poses_device_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `poses_device_id_fkey` ON `poses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` MODIFY `pos_type` ENUM('PSP', 'MOBILE', 'WEB', 'API') NOT NULL,
|
||||
MODIFY `device_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_device_id_fkey` FOREIGN KEY (`device_id`) REFERENCES `devices`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -3,6 +3,9 @@ model Guild {
|
||||
name String
|
||||
code String?
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
business_activities BusinessActivity[]
|
||||
goods Good[]
|
||||
good_categories GoodCategory[]
|
||||
@@ -13,9 +16,11 @@ model Guild {
|
||||
model BusinessActivity {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
created_at DateTime @default(now())
|
||||
guild_id String
|
||||
owner_id String
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
guild_id String
|
||||
owner_id String
|
||||
|
||||
guild Guild @relation(fields: [guild_id], references: [id])
|
||||
user User @relation(fields: [owner_id], references: [id])
|
||||
@@ -32,6 +37,9 @@ model Complex {
|
||||
address String?
|
||||
tax_id String?
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
business_activity_id String
|
||||
|
||||
business_activity BusinessActivity @relation(fields: [business_activity_id], references: [id])
|
||||
@@ -45,19 +53,20 @@ model Complex {
|
||||
|
||||
model Pos {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
serial String @unique
|
||||
model String?
|
||||
status POSStatus @default(ACTIVE)
|
||||
pos_type POSType
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
complex_id String
|
||||
device_id String
|
||||
device_id String?
|
||||
provider_id String?
|
||||
|
||||
complex Complex @relation(fields: [complex_id], references: [id])
|
||||
device Device @relation(fields: [device_id], references: [id])
|
||||
device Device? @relation(fields: [device_id], references: [id])
|
||||
provider Provider? @relation(fields: [provider_id], references: [id])
|
||||
|
||||
licenses License[]
|
||||
|
||||
@@ -2,8 +2,8 @@ model DeviceBrand {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
devices Device[]
|
||||
|
||||
@@ -11,12 +11,14 @@ model DeviceBrand {
|
||||
}
|
||||
|
||||
model Device {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
os_version String?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt()
|
||||
brand_id String
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
brand_id String
|
||||
|
||||
brand DeviceBrand @relation(fields: [brand_id], references: [id])
|
||||
poses Pos[]
|
||||
|
||||
@@ -4,6 +4,9 @@ model License {
|
||||
expires_at DateTime
|
||||
status LicenseStatus
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
pos_id String
|
||||
partner_id String
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
model Partner {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String?
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String?
|
||||
license_quota Int? @default(0)
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(0)
|
||||
|
||||
licenses License[]
|
||||
account Account[]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
// user_type UserType
|
||||
created_at DateTime @default(now())
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
// individual_profile IndividualProfile?
|
||||
// legal_profile LegalProfile?
|
||||
@@ -48,7 +49,8 @@ model Account {
|
||||
type AccountType
|
||||
status AccountStatus
|
||||
password String
|
||||
created_at DateTime @default(now())
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
user_id String
|
||||
user User @relation(fields: [user_id], references: [id])
|
||||
@@ -68,5 +70,8 @@ model Account {
|
||||
verification_codes VerificationCode[]
|
||||
tokens Token[]
|
||||
|
||||
@@unique([user_id, business_id])
|
||||
@@unique([user_id, provider_id])
|
||||
@@unique([user_id, pos_id])
|
||||
@@map("accounts")
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ model Provider {
|
||||
name String
|
||||
code String?
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
|
||||
pos_list Pos[]
|
||||
accounts Account[]
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ enum LicenseStatus {
|
||||
enum POSType {
|
||||
PSP
|
||||
MOBILE
|
||||
WEB
|
||||
API
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ async function main() {
|
||||
password,
|
||||
type: 'ADMIN',
|
||||
status: 'ACTIVE',
|
||||
updated_at: new Date(),
|
||||
user: {
|
||||
create: {
|
||||
first_name: 'عباس',
|
||||
|
||||
Reference in New Issue
Block a user