mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
feat(trash): implement two-stage trashcan and project cleanup
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The values [removed] on the enum `AssetStatus` will be removed. If these variants are still used in the database, this will fail.
|
||||
- You are about to drop the column `removed` on the `assets` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
BEGIN;
|
||||
CREATE TYPE "AssetStatus_new" AS ENUM ('uploading', 'uploaded', 'processing', 'processed', 'trashed', 'pending_purge', 'purging');
|
||||
ALTER TABLE "assets" ALTER COLUMN "status" TYPE "AssetStatus_new" USING ("status"::text::"AssetStatus_new");
|
||||
ALTER TYPE "AssetStatus" RENAME TO "AssetStatus_old";
|
||||
ALTER TYPE "AssetStatus_new" RENAME TO "AssetStatus";
|
||||
DROP TYPE "public"."AssetStatus_old";
|
||||
COMMIT;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "assets_removed_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "assets" DROP COLUMN "removed",
|
||||
ADD COLUMN "is_deleted" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "assets_is_deleted_idx" ON "assets"("is_deleted");
|
||||
@@ -41,7 +41,8 @@ enum AssetStatus {
|
||||
processing
|
||||
processed
|
||||
trashed
|
||||
removed
|
||||
pending_purge
|
||||
purging
|
||||
}
|
||||
|
||||
enum InviteRole {
|
||||
@@ -355,7 +356,7 @@ model Asset {
|
||||
transcodeTaskId String? @map("transcode_task_id")
|
||||
/// [MediaInfo]
|
||||
media Json?
|
||||
removed Boolean @default(false)
|
||||
isDeleted Boolean @default(false) @map("is_deleted")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
sortIndex String? @map("sort_index")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
@@ -396,7 +397,7 @@ model Asset {
|
||||
@@index([createdAt])
|
||||
@@index([updatedAt])
|
||||
@@index([sortIndex])
|
||||
@@index([removed])
|
||||
@@index([isDeleted])
|
||||
@@index([deletedAt])
|
||||
@@index([nameNgram], type: Gin)
|
||||
@@unique([parentId, targetId], name: "parentIdTargetId")
|
||||
|
||||
Reference in New Issue
Block a user