This commit is contained in:
Li1304553726 2025-06-05 15:44:06 +08:00
parent 0a0bcfe8ba
commit e5bb50015e
18 changed files with 510 additions and 124 deletions

View File

@ -10,6 +10,7 @@ POSTGRES_PASSWORD=Letusdoit123
# Redis 配置 # Redis 配置
REDIS_VERSION=7.2.4 REDIS_VERSION=7.2.4
# REDIS_VERSION=latest
REDIS_PASSWORD=nice REDIS_PASSWORD=nice
# MinIO 配置 # MinIO 配置

View File

@ -197,8 +197,7 @@ pnpm build:web # 构建前端
pnpm build:backend # 构建后端 pnpm build:backend # 构建后端
# 数据库 # 数据库
pnpm db:generate # 生成 Prisma 客户端 pnpm db:generate # 运行数据库迁移
pnpm db:migrate # 运行数据库迁移
pnpm db:seed # 填充种子数据 pnpm db:seed # 填充种子数据
pnpm db:studio # 打开 Prisma Studio pnpm db:studio # 打开 Prisma Studio

View File

@ -81,7 +81,7 @@ export class PrismaDatabaseAdapter implements DatabaseAdapter {
data: { data: {
fileId: data.fileId, fileId: data.fileId,
title: data.filename, title: data.filename,
type: data.mimeType, type: data.mimeType ,
storageType: data.storageType, storageType: data.storageType,
status: data.status || 'UPLOADING', status: data.status || 'UPLOADING',
meta: { meta: {

View File

@ -1,5 +1,5 @@
'use client'; 'use client';
export default function HomePage() { export default function HomePage() {
return <></>; return <>sss</>;
} }

View File

@ -3,7 +3,6 @@ import { FileUpload } from '../../components/FileUpload';
import { FileDownload } from '../../components/FileDownload'; import { FileDownload } from '../../components/FileDownload';
import { AdvancedFileDownload } from '../../components/AdvancedFileDownload'; import { AdvancedFileDownload } from '../../components/AdvancedFileDownload';
import { DownloadTester } from '../../components/DownloadTester'; import { DownloadTester } from '../../components/DownloadTester';
export default function UploadPage() { export default function UploadPage() {
return ( return (
<div className="min-h-screen bg-gray-50"> <div className="min-h-screen bg-gray-50">
@ -24,7 +23,7 @@ export default function UploadPage() {
<h2 className="text-xl font-semibold mb-4">🔧 </h2> <h2 className="text-xl font-semibold mb-4">🔧 </h2>
<DownloadTester /> <DownloadTester />
</div> </div>
z
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
{/* 基础下载组件 */} {/* 基础下载组件 */}
<div> <div>

View File

@ -21,7 +21,7 @@ export function FileUpload() {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
const file = files[i]; const file = files[i];
if (!file) continue;
try { try {
const result = await handleFileUpload( const result = await handleFileUpload(
file, file,
@ -89,7 +89,6 @@ export function FileUpload() {
return ( return (
<div className="max-w-2xl mx-auto p-6"> <div className="max-w-2xl mx-auto p-6">
<h2 className="text-2xl font-bold mb-6"></h2> <h2 className="text-2xl font-bold mb-6"></h2>
{/* 服务器信息 */} {/* 服务器信息 */}
<div className="mb-4 p-3 bg-gray-100 rounded-lg"> <div className="mb-4 p-3 bg-gray-100 rounded-lg">
<p className="text-sm text-gray-600"> <p className="text-sm text-gray-600">

View File

@ -3,9 +3,14 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./*"], "@/*": [
"@repo/backend/*": ["../backend/src/*"], "./*"
],
"@repo/backend/*": [
"../backend/src/*"
]
}, },
"jsx": "preserve",
"plugins": [ "plugins": [
{ {
"name": "next" "name": "next"
@ -19,5 +24,7 @@
"**/*.tsx", "**/*.tsx",
".next/types/**/*.ts" ".next/types/**/*.ts"
], ],
"exclude": ["node_modules"] "exclude": [
"node_modules"
]
} }

View File

@ -1,6 +1,6 @@
services: services:
redis: redis:
image: redis:${REDIS_VERSION:-7.2.4} image: redis:latest
container_name: redis container_name: redis
restart: always restart: always
ports: ports:
@ -23,5 +23,5 @@ volumes:
driver: local driver: local
driver_opts: driver_opts:
type: none type: none
device: ${PWD}/volumes/redis device: /opt/projects/nice/volumes/redis
o: bind o: bind

View File

@ -1,13 +1,13 @@
services: services:
db: db:
image: postgres:${POSTGRES_VERSION:-16} image: postgres:latest
container_name: postgres container_name: postgres
ports: ports:
- '5432:5432' - '5432:5432'
environment: environment:
- POSTGRES_DB=${POSTGRES_DB:-nice_db} - POSTGRES_DB=db
- POSTGRES_USER=${POSTGRES_USER:-nice_user} - POSTGRES_USER=nice
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nice_password} - POSTGRES_PASSWORD=nice1234
volumes: volumes:
- ./volumes/postgres:/var/lib/postgresql/data - ./volumes/postgres:/var/lib/postgresql/data
# - type: volume # - type: volume
@ -27,5 +27,5 @@ volumes:
driver: local driver: local
driver_opts: driver_opts:
type: none type: none
device: ${PWD}/volumes/postgres device: /opt/projects/nice/volumes/postgres
o: bind o: bind

View File

@ -1,6 +1,6 @@
services: services:
elasticsearch: elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION:-8.12.2} image: docker.elastic.co/elasticsearch/elasticsearch:9.0.1
container_name: elasticsearch container_name: elasticsearch
restart: always restart: always
ports: ports:
@ -11,7 +11,7 @@ services:
environment: environment:
- discovery.type=single-node - discovery.type=single-node
- xpack.security.enabled=true - xpack.security.enabled=true
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD:-nice_elastic_password} - ELASTIC_PASSWORD=nice_elastic_password
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m' - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
volumes: volumes:
- type: volume - type: volume
@ -32,5 +32,5 @@ volumes:
driver: local driver: local
driver_opts: driver_opts:
type: none type: none
device: ${PWD}/volumes/elasticsearch device: /opt/projects/nice/volumes/elasticsearch
o: bind o: bind

View File

@ -1,6 +1,6 @@
services: services:
minio: minio:
image: minio/minio:${MINIO_VERSION:-RELEASE.2024-04-18T19-09-19Z} image: minio/minio
container_name: minio container_name: minio
restart: always restart: always
ports: ports:
@ -9,8 +9,8 @@ services:
networks: networks:
- nice-net - nice-net
environment: environment:
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY:-nice_minio_access} - MINIO_ACCESS_KEY=nice1234
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-nice_minio_secret} - MINIO_SECRET_KEY=nice1234
volumes: volumes:
- ./volumes/minio:/data - ./volumes/minio:/data
command: server /data --console-address ":9001" command: server /data --console-address ":9001"
@ -25,5 +25,5 @@ volumes:
driver: local driver: local
driver_opts: driver_opts:
type: none type: none
device: ${PWD}/volumes/minio device: /opt/projects/nice/volumes/minio
o: bind o: bind

View File

@ -0,0 +1,385 @@
/*
Warnings:
- You are about to drop the column `avatar` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `created_time` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `deactivated_time` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `deleted_time` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `is_admin` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `is_system` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `last_modified_time` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `last_sign_time` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `password` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `phone` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `salt` on the `users` table. All the data in the column will be lost.
- You are about to drop the `attachments` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `notification` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `oidc_clients` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `resource` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `setting` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `trash` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `user_last_visit` table. If the table is not empty, all the data it contains will be lost.
- A unique constraint covering the columns `[username]` on the table `users` will be added. If there are existing duplicate values, this will fail.
- Added the required column `updatedAt` to the `users` table without a default value. This is not possible if the table is not empty.
- Added the required column `username` to the `users` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "Status" AS ENUM ('ACTIVE', 'INACTIVE');
-- CreateEnum
CREATE TYPE "SourceType" AS ENUM ('DATABASE', 'API', 'FILE', 'ERP', 'MES', 'IOT', 'STREAM');
-- CreateEnum
CREATE TYPE "PipelineType" AS ENUM ('SYNC', 'TRANSFORM', 'STREAM', 'HYBRID');
-- CreateEnum
CREATE TYPE "ExecutionStatus" AS ENUM ('PENDING', 'RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED');
-- CreateEnum
CREATE TYPE "DataFormat" AS ENUM ('PARQUET', 'JSON', 'CSV', 'AVRO', 'DELTA');
-- CreateEnum
CREATE TYPE "AssetType" AS ENUM ('BATCH', 'STREAM', 'TABLE', 'VIEW', 'MODEL');
-- CreateEnum
CREATE TYPE "AssetStatus" AS ENUM ('ACTIVE', 'ARCHIVED', 'DEPRECATED');
-- CreateEnum
CREATE TYPE "QueryEngine" AS ENUM ('DUCKDB', 'ATHENA', 'SPARK', 'TRINO');
-- CreateEnum
CREATE TYPE "QueryStatus" AS ENUM ('PENDING', 'RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED');
-- CreateEnum
CREATE TYPE "EntityType" AS ENUM ('PERSON', 'EQUIPMENT', 'FACILITY', 'MATERIAL', 'ORGANIZATION', 'PROJECT', 'CUSTOM');
-- CreateEnum
CREATE TYPE "LineageStatus" AS ENUM ('ACTIVE', 'ARCHIVED');
-- DropIndex
DROP INDEX "users_phone_key";
-- AlterTable
ALTER TABLE "users" DROP COLUMN "avatar",
DROP COLUMN "created_time",
DROP COLUMN "deactivated_time",
DROP COLUMN "deleted_time",
DROP COLUMN "is_admin",
DROP COLUMN "is_system",
DROP COLUMN "last_modified_time",
DROP COLUMN "last_sign_time",
DROP COLUMN "password",
DROP COLUMN "phone",
DROP COLUMN "salt",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "roles" JSONB,
ADD COLUMN "status" "Status" NOT NULL DEFAULT 'ACTIVE',
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ADD COLUMN "username" TEXT NOT NULL;
-- DropTable
DROP TABLE "attachments";
-- DropTable
DROP TABLE "notification";
-- DropTable
DROP TABLE "oidc_clients";
-- DropTable
DROP TABLE "resource";
-- DropTable
DROP TABLE "setting";
-- DropTable
DROP TABLE "trash";
-- DropTable
DROP TABLE "user_last_visit";
-- CreateTable
CREATE TABLE "data_sources" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"code" TEXT NOT NULL,
"type" "SourceType" NOT NULL,
"config" JSONB NOT NULL,
"description" TEXT,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"schemaVersion" TEXT DEFAULT '1.0',
"lastSynced" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "data_sources_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "pipelines" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" "PipelineType" NOT NULL,
"schedule" TEXT,
"config" JSONB NOT NULL,
"description" TEXT,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"dataSourceId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "pipelines_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "pipeline_executions" (
"id" TEXT NOT NULL,
"executionId" TEXT NOT NULL,
"status" "ExecutionStatus" NOT NULL DEFAULT 'PENDING',
"inputRecords" INTEGER NOT NULL DEFAULT 0,
"outputRecords" INTEGER NOT NULL DEFAULT 0,
"errorRecords" INTEGER NOT NULL DEFAULT 0,
"startedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"completedAt" TIMESTAMP(3),
"duration" INTEGER,
"metadata" JSONB,
"errorMsg" TEXT,
"pipelineId" TEXT NOT NULL,
CONSTRAINT "pipeline_executions_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "data_assets" (
"id" TEXT NOT NULL,
"assetId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" "AssetType" NOT NULL DEFAULT 'BATCH',
"format" "DataFormat" NOT NULL DEFAULT 'PARQUET',
"storageConfig" JSONB NOT NULL,
"schema" JSONB,
"partitions" JSONB,
"size" BIGINT,
"recordCount" BIGINT,
"qualityScore" DOUBLE PRECISION,
"executionId" TEXT,
"status" "AssetStatus" NOT NULL DEFAULT 'ACTIVE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "data_assets_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "queries" (
"id" TEXT NOT NULL,
"queryId" TEXT NOT NULL,
"sql" TEXT NOT NULL,
"engine" "QueryEngine" NOT NULL DEFAULT 'DUCKDB',
"status" "QueryStatus" NOT NULL DEFAULT 'PENDING',
"resultCount" BIGINT,
"resultPath" TEXT,
"duration" INTEGER,
"errorMsg" TEXT,
"tags" JSONB,
"assetId" TEXT NOT NULL,
"userId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"completedAt" TIMESTAMP(3),
CONSTRAINT "queries_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "entities" (
"id" TEXT NOT NULL,
"code" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" "EntityType" NOT NULL,
"attributes" JSONB,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"parentId" TEXT,
"path" TEXT,
"level" INTEGER,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "entities_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "entity_relations" (
"id" TEXT NOT NULL,
"sourceId" TEXT NOT NULL,
"targetId" TEXT NOT NULL,
"relationship" TEXT NOT NULL,
"attributes" JSONB,
"startDate" TIMESTAMP(3),
"endDate" TIMESTAMP(3),
"metadata" JSONB,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "entity_relations_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "lineage_records" (
"id" TEXT NOT NULL,
"sourceType" TEXT NOT NULL,
"sourceId" TEXT NOT NULL,
"targetType" TEXT NOT NULL,
"targetId" TEXT NOT NULL,
"relationship" TEXT NOT NULL,
"metadata" JSONB,
"executionId" TEXT,
"entityId" TEXT,
"status" "LineageStatus" NOT NULL DEFAULT 'ACTIVE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "lineage_records_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "quality_rules" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"rule" JSONB NOT NULL,
"threshold" DOUBLE PRECISION,
"entityType" TEXT,
"entityId" TEXT,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "quality_rules_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "data_catalogs" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"tags" JSONB,
"owner" TEXT,
"category" TEXT,
"sensitivity" TEXT,
"assetType" TEXT NOT NULL,
"assetId" TEXT NOT NULL,
"status" "Status" NOT NULL DEFAULT 'ACTIVE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "data_catalogs_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "data_sources_code_key" ON "data_sources"("code");
-- CreateIndex
CREATE UNIQUE INDEX "pipeline_executions_executionId_key" ON "pipeline_executions"("executionId");
-- CreateIndex
CREATE UNIQUE INDEX "data_assets_assetId_key" ON "data_assets"("assetId");
-- CreateIndex
CREATE INDEX "data_assets_type_status_idx" ON "data_assets"("type", "status");
-- CreateIndex
CREATE INDEX "data_assets_createdAt_idx" ON "data_assets"("createdAt");
-- CreateIndex
CREATE UNIQUE INDEX "queries_queryId_key" ON "queries"("queryId");
-- CreateIndex
CREATE INDEX "queries_status_createdAt_idx" ON "queries"("status", "createdAt");
-- CreateIndex
CREATE UNIQUE INDEX "entities_code_key" ON "entities"("code");
-- CreateIndex
CREATE INDEX "entities_type_status_idx" ON "entities"("type", "status");
-- CreateIndex
CREATE INDEX "entities_code_idx" ON "entities"("code");
-- CreateIndex
CREATE INDEX "entities_type_code_idx" ON "entities"("type", "code");
-- CreateIndex
CREATE INDEX "entities_parentId_idx" ON "entities"("parentId");
-- CreateIndex
CREATE INDEX "entities_path_idx" ON "entities"("path");
-- CreateIndex
CREATE INDEX "entities_type_parentId_idx" ON "entities"("type", "parentId");
-- CreateIndex
CREATE INDEX "entities_level_idx" ON "entities"("level");
-- CreateIndex
CREATE INDEX "entity_relations_sourceId_idx" ON "entity_relations"("sourceId");
-- CreateIndex
CREATE INDEX "entity_relations_targetId_idx" ON "entity_relations"("targetId");
-- CreateIndex
CREATE INDEX "entity_relations_relationship_idx" ON "entity_relations"("relationship");
-- CreateIndex
CREATE INDEX "entity_relations_sourceId_relationship_idx" ON "entity_relations"("sourceId", "relationship");
-- CreateIndex
CREATE INDEX "entity_relations_targetId_relationship_idx" ON "entity_relations"("targetId", "relationship");
-- CreateIndex
CREATE INDEX "entity_relations_relationship_status_idx" ON "entity_relations"("relationship", "status");
-- CreateIndex
CREATE UNIQUE INDEX "entity_relations_sourceId_targetId_relationship_key" ON "entity_relations"("sourceId", "targetId", "relationship");
-- CreateIndex
CREATE INDEX "lineage_records_relationship_idx" ON "lineage_records"("relationship");
-- CreateIndex
CREATE UNIQUE INDEX "lineage_records_sourceType_sourceId_targetType_targetId_key" ON "lineage_records"("sourceType", "sourceId", "targetType", "targetId");
-- CreateIndex
CREATE INDEX "data_catalogs_category_idx" ON "data_catalogs"("category");
-- CreateIndex
CREATE UNIQUE INDEX "data_catalogs_assetType_assetId_key" ON "data_catalogs"("assetType", "assetId");
-- CreateIndex
CREATE UNIQUE INDEX "users_username_key" ON "users"("username");
-- AddForeignKey
ALTER TABLE "pipelines" ADD CONSTRAINT "pipelines_dataSourceId_fkey" FOREIGN KEY ("dataSourceId") REFERENCES "data_sources"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "pipeline_executions" ADD CONSTRAINT "pipeline_executions_pipelineId_fkey" FOREIGN KEY ("pipelineId") REFERENCES "pipelines"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "data_assets" ADD CONSTRAINT "data_assets_executionId_fkey" FOREIGN KEY ("executionId") REFERENCES "pipeline_executions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "queries" ADD CONSTRAINT "queries_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES "data_assets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "entities" ADD CONSTRAINT "entities_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "entities"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "entity_relations" ADD CONSTRAINT "entity_relations_sourceId_fkey" FOREIGN KEY ("sourceId") REFERENCES "entities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "entity_relations" ADD CONSTRAINT "entity_relations_targetId_fkey" FOREIGN KEY ("targetId") REFERENCES "entities"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "lineage_records" ADD CONSTRAINT "lineage_records_executionId_fkey" FOREIGN KEY ("executionId") REFERENCES "pipeline_executions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "lineage_records" ADD CONSTRAINT "lineage_records_entityId_fkey" FOREIGN KEY ("entityId") REFERENCES "entities"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -0,0 +1,28 @@
-- CreateTable
CREATE TABLE "resource" (
"id" TEXT NOT NULL,
"title" TEXT,
"description" TEXT,
"type" TEXT,
"fileId" TEXT,
"url" TEXT,
"meta" JSONB,
"status" TEXT,
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3),
"created_by" TEXT,
"updated_by" TEXT,
"deleted_at" TIMESTAMP(3),
"is_public" BOOLEAN DEFAULT true,
CONSTRAINT "resource_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "resource_fileId_key" ON "resource"("fileId");
-- CreateIndex
CREATE INDEX "resource_type_idx" ON "resource"("type");
-- CreateIndex
CREATE INDEX "resource_created_at_idx" ON "resource"("created_at");

View File

@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the column `is_public` on the `resource` table. All the data in the column will be lost.
- Added the required column `storage_type` to the `resource` table without a default value. This is not possible if the table is not empty.
- Made the column `title` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `fileId` on table `resource` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "resource" DROP COLUMN "is_public",
ADD COLUMN "storage_type" TEXT NOT NULL,
ALTER COLUMN "title" SET NOT NULL,
ALTER COLUMN "fileId" SET NOT NULL;

View File

@ -0,0 +1,22 @@
/*
Warnings:
- Made the column `description` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `type` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `meta` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `created_at` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `updated_at` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `created_by` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `updated_by` on table `resource` required. This step will fail if there are existing NULL values in that column.
- Made the column `deleted_at` on table `resource` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "resource" ALTER COLUMN "description" SET NOT NULL,
ALTER COLUMN "type" SET NOT NULL,
ALTER COLUMN "meta" SET NOT NULL,
ALTER COLUMN "created_at" SET NOT NULL,
ALTER COLUMN "updated_at" SET NOT NULL,
ALTER COLUMN "created_by" SET NOT NULL,
ALTER COLUMN "updated_by" SET NOT NULL,
ALTER COLUMN "deleted_at" SET NOT NULL;

View File

@ -0,0 +1,9 @@
-- AlterTable
ALTER TABLE "resource" ADD COLUMN "is_public" BOOLEAN DEFAULT true,
ALTER COLUMN "description" DROP NOT NULL,
ALTER COLUMN "type" DROP NOT NULL,
ALTER COLUMN "meta" DROP NOT NULL,
ALTER COLUMN "created_by" DROP NOT NULL,
ALTER COLUMN "updated_by" DROP NOT NULL,
ALTER COLUMN "deleted_at" DROP NOT NULL,
ALTER COLUMN "storage_type" DROP NOT NULL;

View File

@ -402,3 +402,25 @@ enum LineageStatus {
ACTIVE ACTIVE
ARCHIVED ARCHIVED
} }
model Resource {
id String @id @default(cuid()) @map("id")
title String @map("title")
description String? @map("description")
type String? @map("type")
fileId String @unique
url String?
meta Json? @map("meta")
status String?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
createdBy String? @map("created_by")
updatedBy String? @map("updated_by")
deletedAt DateTime? @map("deleted_at")
isPublic Boolean? @default(true) @map("is_public")
storageType String? @map("storage_type")
// 索引
@@index([type])
@@index([createdAt])
@@map("resource")
}

View File

@ -515,61 +515,6 @@ importers:
specifier: ^5.0.0 specifier: ^5.0.0
version: 5.8.3 version: 5.8.3
packages/tus:
dependencies:
'@aws-sdk/client-s3':
specifier: ^3.723.0
version: 3.817.0
'@shopify/semaphore':
specifier: ^3.1.0
version: 3.1.0
debug:
specifier: ^4.4.0
version: 4.4.1
lodash.throttle:
specifier: ^4.1.1
version: 4.1.1
multistream:
specifier: ^4.1.0
version: 4.1.0
devDependencies:
'@redis/client':
specifier: ^1.6.0
version: 1.6.1
'@types/debug':
specifier: ^4.1.12
version: 4.1.12
'@types/lodash.throttle':
specifier: ^4.1.9
version: 4.1.9
'@types/multistream':
specifier: ^4.1.3
version: 4.1.3
'@types/node':
specifier: ^20.3.1
version: 20.17.50
concurrently:
specifier: ^8.0.0
version: 8.2.2
ioredis:
specifier: ^5.4.1
version: 5.4.1
rimraf:
specifier: ^6.0.1
version: 6.0.1
should:
specifier: ^13.2.3
version: 13.2.3
ts-node:
specifier: ^10.9.1
version: 10.9.2(@swc/core@1.11.29(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)
tsup:
specifier: ^8.3.5
version: 8.5.0(@swc/core@1.11.29(@swc/helpers@0.5.17))(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.4)(typescript@5.8.3)(yaml@2.8.0)
typescript:
specifier: ^5.5.4
version: 5.8.3
packages/typescript-config: {} packages/typescript-config: {}
packages/ui: packages/ui:
@ -5117,24 +5062,6 @@ packages:
resolution: {integrity: sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==} resolution: {integrity: sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
should-equal@2.0.0:
resolution: {integrity: sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==}
should-format@3.0.3:
resolution: {integrity: sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==}
should-type-adaptors@1.1.0:
resolution: {integrity: sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==}
should-type@1.4.0:
resolution: {integrity: sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==}
should-util@1.0.1:
resolution: {integrity: sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==}
should@13.2.3:
resolution: {integrity: sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==}
side-channel-list@1.0.0: side-channel-list@1.0.0:
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -10984,32 +10911,6 @@ snapshots:
shell-quote@1.8.2: {} shell-quote@1.8.2: {}
should-equal@2.0.0:
dependencies:
should-type: 1.4.0
should-format@3.0.3:
dependencies:
should-type: 1.4.0
should-type-adaptors: 1.1.0
should-type-adaptors@1.1.0:
dependencies:
should-type: 1.4.0
should-util: 1.0.1
should-type@1.4.0: {}
should-util@1.0.1: {}
should@13.2.3:
dependencies:
should-equal: 2.0.0
should-format: 3.0.3
should-type: 1.4.0
should-type-adaptors: 1.1.0
should-util: 1.0.1
side-channel-list@1.0.0: side-channel-list@1.0.0:
dependencies: dependencies:
es-errors: 1.3.0 es-errors: 1.3.0