-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from besscroft/dev
v0.5.1
- Loading branch information
Showing
9 changed files
with
136 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { PrismaClient } from '@prisma/client' | ||
|
||
export async function register() { | ||
try { | ||
if (process.env.NEXT_RUNTIME === 'edge') { | ||
return | ||
} | ||
const prisma = new PrismaClient() | ||
if (prisma) { | ||
await prisma.$transaction(async (tx) => { | ||
await tx.configs.createMany({ | ||
data: [ | ||
{ config_key: 'accesskey_id', config_value: '', detail: '阿里 OSS / AWS S3 AccessKey_ID' }, | ||
{ config_key: 'accesskey_secret', config_value: '', detail: '阿里 OSS / AWS S3 AccessKey_Secret' }, | ||
{ config_key: 'region', config_value: '', detail: '阿里 OSS / AWS S3 Region 地域,如:oss-cn-hongkong' }, | ||
{ config_key: 'endpoint', config_value: '', detail: '阿里 OSS / AWS S3 Endpoint 地域节点,如:oss-cn-hongkong.aliyuncs.com' }, | ||
{ config_key: 'bucket', config_value: '', detail: '阿里 OSS / AWS S3 Bucket 存储桶名称,如:picimpact' }, | ||
{ config_key: 'storage_folder', config_value: '', detail: '存储文件夹(S3),严格格式,如:picimpact 或 picimpact/images ,填 / 或者不填表示根路径' }, | ||
{ config_key: 'alist_token', config_value: '', detail: 'alist 令牌' }, | ||
{ config_key: 'alist_url', config_value: '', detail: 'AList 地址,如:https://alist.besscroft.com' }, | ||
{ config_key: 'secret_key', config_value: 'pic-impact', detail: 'SECRET_KEY' }, | ||
{ config_key: 'r2_accesskey_id', config_value: '', detail: 'Cloudflare AccessKey_ID' }, | ||
{ config_key: 'r2_accesskey_secret', config_value: '', detail: 'Cloudflare AccessKey_Secret' }, | ||
{ config_key: 'r2_endpoint', config_value: '', detail: 'Cloudflare Endpoint 地域节点,如:https://<ACCOUNT_ID>.r2.cloudflarestorage.com' }, | ||
{ config_key: 'r2_bucket', config_value: '', detail: 'Cloudflare Bucket 存储桶名称,如:picimpact' }, | ||
{ config_key: 'r2_storage_folder', config_value: '', detail: '存储文件夹(Cloudflare R2),严格格式,如:picimpact 或 picimpact/images ,填 / 或者不填表示根路径' }, | ||
{ config_key: 'r2_public_domain', config_value: '', detail: 'Cloudflare R2 自定义域(公开访问)' }, | ||
], | ||
skipDuplicates: true, | ||
}) | ||
}) | ||
console.log('数据库初始化完毕!') | ||
await prisma.$disconnect() | ||
} else { | ||
console.error('数据库初始化失败,请检查您的连接信息!') | ||
} | ||
} catch (e) { | ||
console.error('初始化数据失败,您可能需要准备干净的数据表,请联系管理员!', e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,9 @@ | |
"private": true, | ||
"author": "Bess Croft <[email protected]>", | ||
"scripts": { | ||
"dev": "next dev", | ||
"dev": "pnpm run prisma:generate && next dev", | ||
"build": "next build", | ||
"build:vercel": "pnpm run prisma:deploy && next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"prisma:format": "npx prisma format", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters