Skip to content

Commit

Permalink
chore(sql): 更新数据库文件
Browse files Browse the repository at this point in the history
  • Loading branch information
besscroft committed Apr 8, 2024
1 parent 11d3538 commit 8f6cb26
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 137 deletions.
11 changes: 11 additions & 0 deletions doc/sql/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- 第一次初始化数据库时,执行这个 sql 文件内的 sql
INSERT INTO "public"."Configs" VALUES (1, 'accesskey_id', '', '阿里 OSS / AWS S3 AccessKey_ID', '2023-12-25 16:45:54.284484', NULL);
INSERT INTO "public"."Configs" VALUES (2, 'accesskey_secret', '', '阿里 OSS / AWS S3 AccessKey_Secret', '2023-12-25 16:46:02.552455', NULL);
INSERT INTO "public"."Configs" VALUES (3, 'region', '', '阿里 OSS / AWS S3 Region 地域,如:oss-cn-hongkong', '2023-12-25 16:46:14.881791', NULL);
INSERT INTO "public"."Configs" VALUES (4, 'endpoint', '', '阿里 OSS / AWS S3 Endpoint 地域节点,如:oss-cn-hongkong.aliyuncs.com', '2023-12-25 16:46:26.247859', NULL);
INSERT INTO "public"."Configs" VALUES (5, 'bucket', '', '阿里 OSS / AWS S3 Bucket 存储桶名称,如:picimpact', '2023-12-25 16:46:38.700241', NULL);
INSERT INTO "public"."Configs" VALUES (6, 'storage_folder', 'picimpact', '存储文件夹(S3),严格格式,如:picimpact 或 picimpact/images ,填 / 或者不填表示根路径', '2023-12-25 16:46:50.732653', NULL);
INSERT INTO "public"."Configs" VALUES (7, 'alist_token', '', 'alist 令牌 ', '2023-12-25 16:45:08.661365', NULL);
INSERT INTO "public"."Configs" VALUES (8, 'alist_url', '', 'AList 地址,如:https://alist.besscroft.com', '2023-12-25 16:44:55.289006', NULL);

INSERT INTO "public"."User" VALUES (1, 'admin', '[email protected]', '51630b15b0cec2da9926af7015db33b7809f9d24959a0d48665b83e9d19216cd5601d08a622a8b2c48709d5bbb62eef6ae76addce5d18703b28965eef62d491b', null, 'https://bbs-static.miyoushe.com/communityweb/upload/97734c89374997c7c87d5af5f7442171.png');
123 changes: 0 additions & 123 deletions doc/sql/schema.sql

This file was deleted.

48 changes: 48 additions & 0 deletions prisma/migrations/20240408041827_v1/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-- CreateTable
CREATE TABLE "Images" (
"id" SERIAL NOT NULL,
"tag" TEXT NOT NULL,
"url" TEXT,
"exif" JSON,
"rating" SMALLINT,
"detail" TEXT,
"show" SMALLINT NOT NULL DEFAULT 1,
"sort" SMALLINT NOT NULL DEFAULT 0,
"create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"update_time" TIMESTAMP,
"del" SMALLINT NOT NULL DEFAULT 0,

CONSTRAINT "Images_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Configs" (
"id" SERIAL NOT NULL,
"config_key" TEXT NOT NULL,
"config_value" TEXT,
"detail" TEXT,
"create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"update_time" TIMESTAMP,

CONSTRAINT "Configs_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Tags" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"tag_value" TEXT NOT NULL,
"detail" TEXT,
"show" SMALLINT NOT NULL DEFAULT 1,
"create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"update_time" TIMESTAMP,
"del" SMALLINT NOT NULL DEFAULT 0,

CONSTRAINT "Tags_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Configs_config_key_key" ON "Configs"("config_key");

-- CreateIndex
CREATE UNIQUE INDEX "Tags_tag_value_key" ON "Tags"("tag_value");
62 changes: 48 additions & 14 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
}

model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
Expand Down Expand Up @@ -51,4 +51,38 @@ model VerificationToken {
expires DateTime
@@unique([identifier, token])
}
}

model Images {
id Int @id @default(autoincrement())
tag String
url String? @db.Text
exif Json? @db.Json
rating Int? @db.SmallInt
detail String? @db.Text
show Int @default(1) @db.SmallInt
sort Int @default(0) @db.SmallInt
create_time DateTime? @default(now()) @db.Timestamp()
update_time DateTime? @db.Timestamp()
del Int @default(0) @db.SmallInt
}

model Configs {
id Int @id @default(autoincrement())
config_key String @unique
config_value String? @db.Text
detail String? @db.Text
create_time DateTime? @default(now()) @db.Timestamp()
update_time DateTime? @db.Timestamp()
}

model Tags {
id Int @id @default(autoincrement())
name String
tag_value String @unique
detail String? @db.Text
show Int @default(1) @db.SmallInt
create_time DateTime? @default(now()) @db.Timestamp()
update_time DateTime? @db.Timestamp()
del Int @default(0) @db.SmallInt
}

0 comments on commit 8f6cb26

Please sign in to comment.