Skip to content

Commit

Permalink
Add purge artifact from stalled app or org
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusefendi52 committed Dec 8, 2024
1 parent c8e692d commit 7127b90
Show file tree
Hide file tree
Showing 10 changed files with 1,011 additions and 60 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"pg": "^8.11.3",
"primeicons": "^7.0.0",
"primevue": "^4.0.2",
"simple-xml-to-json": "^1.2.3",
"slugify": "^1.6.6",
"uuidv7": "^1.0.1",
"vitest": "^2.1.2",
Expand Down
9 changes: 8 additions & 1 deletion server/api/artifacts/upload-artifact.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import { count } from "drizzle-orm"
import type { LibSQLDatabase } from "drizzle-orm/libsql"
import { uuidv7 } from "uuidv7"

export type UploadTempValue = {
fileKey: string
orgId: string
appId: string
apkFileKey?: string | undefined
}

export async function findApiKey(
db: LibSQLDatabase<typeof tables>,
apiKeyId: string,
Expand Down Expand Up @@ -116,7 +123,7 @@ export default defineEventHandler(async (event) => {
...(apkUrl ? {
apkFileKey: apkUrl?.fileKey
} : undefined),
},
} satisfies UploadTempValue,
group: 'upload_temp',
createdAt: now,
updatedAt: now,
Expand Down
23 changes: 23 additions & 0 deletions server/db/drizzle/0053_polite_arclight.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_artifacts` (
`id` text PRIMARY KEY NOT NULL,
`fileObjectKey` text NOT NULL,
`file_object_apk_key` text,
`versionName2` text NOT NULL,
`versionCode2` text NOT NULL,
`releaseNotes` text,
`createdAt` integer,
`updatedAt` integer,
`releaseId` integer NOT NULL,
`extension` text,
`packageName` text,
`appsId` text,
`organizationId` text
);
--> statement-breakpoint
INSERT INTO `__new_artifacts`("id", "fileObjectKey", "file_object_apk_key", "versionName2", "versionCode2", "releaseNotes", "createdAt", "updatedAt", "releaseId", "extension", "packageName", "appsId", "organizationId") SELECT "id", "fileObjectKey", "file_object_apk_key", "versionName2", "versionCode2", "releaseNotes", "createdAt", "updatedAt", "releaseId", "extension", "packageName", "appsId", "organizationId" FROM `artifacts`;--> statement-breakpoint
DROP TABLE `artifacts`;--> statement-breakpoint
ALTER TABLE `__new_artifacts` RENAME TO `artifacts`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE UNIQUE INDEX `artifacts_id_unique` ON `artifacts` (`id`);--> statement-breakpoint
CREATE UNIQUE INDEX `artifacts_appsId_releaseId_unique` ON `artifacts` (`appsId`,`releaseId`);
Loading

0 comments on commit 7127b90

Please sign in to comment.