diff --git a/server/api/artifacts/upload-artifact-url.post.ts b/server/api/artifacts/upload-artifact-url.post.ts index 10aabc9..2c11d4f 100644 --- a/server/api/artifacts/upload-artifact-url.post.ts +++ b/server/api/artifacts/upload-artifact-url.post.ts @@ -10,6 +10,7 @@ export default defineEventHandler(async (event) => { packageMetadata: z.any(), }).parse) var appId: string + var orgId: string const apiKey = getHeader(event, 'API-KEY') const db = event.context.drizzle @@ -23,8 +24,9 @@ export default defineEventHandler(async (event) => { } const apiKeyPayload = await verifyToken(event, apiKey, apiAuthKey) - const { appsId } = await findApiKey(db, apiKeyPayload.id, orgName, appName) + const { appsId, organizationId } = await findApiKey(db, apiKeyPayload.id, orgName, appName) appId = appsId! + orgId = organizationId! } else { if (await roleEditNotAllowed(event, orgName)) { throw createError({ @@ -33,8 +35,9 @@ export default defineEventHandler(async (event) => { }) } - const { userApp } = await getUserApp(event, orgName, appName) + const { userApp, userOrg } = await getUserApp(event, orgName, appName) appId = userApp.id + orgId = userOrg.org!.id } const packageData = packageMetadata as { @@ -69,6 +72,7 @@ export default defineEventHandler(async (event) => { versionCode2: packageData?.versionCode?.toString()!, versionName2: packageData?.versionName!, appsId: appId, + organizationId: orgId, releaseNotes: releaseNotes, releaseId: newReleaseId, extension: packageData?.extension, diff --git a/server/db/drizzle/0048_eager_vindicator.sql b/server/db/drizzle/0048_eager_vindicator.sql new file mode 100644 index 0000000..bfb81de --- /dev/null +++ b/server/db/drizzle/0048_eager_vindicator.sql @@ -0,0 +1 @@ +ALTER TABLE `artifacts` ADD `organizationId` text; \ No newline at end of file diff --git a/server/db/drizzle/0049_open_shockwave.sql b/server/db/drizzle/0049_open_shockwave.sql new file mode 100644 index 0000000..f56d7b1 --- /dev/null +++ b/server/db/drizzle/0049_open_shockwave.sql @@ -0,0 +1 @@ +ALTER TABLE `artifacts` ALTER COLUMN "organizationId" TO "organizationId" text REFERENCES organizations(id) ON DELETE set null ON UPDATE no action; \ No newline at end of file diff --git a/server/db/drizzle/meta/0048_snapshot.json b/server/db/drizzle/meta/0048_snapshot.json new file mode 100644 index 0000000..2509963 --- /dev/null +++ b/server/db/drizzle/meta/0048_snapshot.json @@ -0,0 +1,885 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "1dd5b490-b449-4ab4-a346-62013ab01d9a", + "prevId": "31e45279-cbd6-4c2c-9d9e-f01ee036d577", + "tables": { + "apiKeys": { + "name": "apiKeys", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apiKeys_id_unique": { + "name": "apiKeys_id_unique", + "columns": [ + "id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "apiKeys_organizationId_organizations_id_fk": { + "name": "apiKeys_organizationId_organizations_id_fk", + "tableFrom": "apiKeys", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apiKeys_appsId_apps_id_fk": { + "name": "apiKeys_appsId_apps_id_fk", + "tableFrom": "apiKeys", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apps": { + "name": "apps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "osType": { + "name": "osType", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationsId": { + "name": "organizationsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apps_id_unique": { + "name": "apps_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "apps_organizationsId_name_unique": { + "name": "apps_organizationsId_name_unique", + "columns": [ + "organizationsId", + "name" + ], + "isUnique": true + } + }, + "foreignKeys": { + "apps_organizationsId_organizations_id_fk": { + "name": "apps_organizationsId_organizations_id_fk", + "tableFrom": "apps", + "tableTo": "organizations", + "columnsFrom": [ + "organizationsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifacts": { + "name": "artifacts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "fileObjectKey": { + "name": "fileObjectKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_object_apk_key": { + "name": "file_object_apk_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "versionName2": { + "name": "versionName2", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "versionCode2": { + "name": "versionCode2", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "releaseNotes": { + "name": "releaseNotes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "releaseId": { + "name": "releaseId", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "extension": { + "name": "extension", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "packageName": { + "name": "packageName", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "artifacts_id_unique": { + "name": "artifacts_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "artifacts_appsId_releaseId_unique": { + "name": "artifacts_appsId_releaseId_unique", + "columns": [ + "appsId", + "releaseId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifacts_appsId_apps_id_fk": { + "name": "artifacts_appsId_apps_id_fk", + "tableFrom": "artifacts", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifactsGroups": { + "name": "artifactsGroups", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publicId": { + "name": "publicId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "isPublic": { + "name": "isPublic", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "artifactsGroups_id_unique": { + "name": "artifactsGroups_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "artifactsGroups_appsId_name_unique": { + "name": "artifactsGroups_appsId_name_unique", + "columns": [ + "appsId", + "name" + ], + "isUnique": true + }, + "artifactsGroups_appsId_name_publicId_unique": { + "name": "artifactsGroups_appsId_name_publicId_unique", + "columns": [ + "appsId", + "name", + "publicId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifactsGroups_appsId_apps_id_fk": { + "name": "artifactsGroups_appsId_apps_id_fk", + "tableFrom": "artifactsGroups", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifactsGroupsManager": { + "name": "artifactsGroupsManager", + "columns": { + "artifactsId": { + "name": "artifactsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifactsGroupsId": { + "name": "artifactsGroupsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "artifactsGroupsManager_artifactsId_artifactsGroupsId_unique": { + "name": "artifactsGroupsManager_artifactsId_artifactsGroupsId_unique", + "columns": [ + "artifactsId", + "artifactsGroupsId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifactsGroupsManager_artifactsId_artifacts_id_fk": { + "name": "artifactsGroupsManager_artifactsId_artifacts_id_fk", + "tableFrom": "artifactsGroupsManager", + "tableTo": "artifacts", + "columnsFrom": [ + "artifactsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "artifactsGroupsManager_artifactsGroupsId_artifactsGroups_id_fk": { + "name": "artifactsGroupsManager_artifactsGroupsId_artifactsGroups_id_fk", + "tableFrom": "artifactsGroupsManager", + "tableTo": "artifactsGroups", + "columnsFrom": [ + "artifactsGroupsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "grouptester": { + "name": "grouptester", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "testerId": { + "name": "testerId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifactGroupId": { + "name": "artifactGroupId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "grouptester_id_unique": { + "name": "grouptester_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "testerId_orgId_appId_groupId": { + "name": "testerId_orgId_appId_groupId", + "columns": [ + "testerId", + "organizationId", + "appsId", + "artifactGroupId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "grouptester_testerId_users_id_fk": { + "name": "grouptester_testerId_users_id_fk", + "tableFrom": "grouptester", + "tableTo": "users", + "columnsFrom": [ + "testerId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_organizationId_organizations_id_fk": { + "name": "grouptester_organizationId_organizations_id_fk", + "tableFrom": "grouptester", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_appsId_apps_id_fk": { + "name": "grouptester_appsId_apps_id_fk", + "tableFrom": "grouptester", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_artifactGroupId_artifactsGroups_id_fk": { + "name": "grouptester_artifactGroupId_artifactsGroups_id_fk", + "tableFrom": "grouptester", + "tableTo": "artifactsGroups", + "columnsFrom": [ + "artifactGroupId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "organizations": { + "name": "organizations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organizations_id_unique": { + "name": "organizations_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "organizations_name_unique": { + "name": "organizations_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "organizationsPeople": { + "name": "organizationsPeople", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organizationsPeople_userId_organizationId_unique": { + "name": "organizationsPeople_userId_organizationId_unique", + "columns": [ + "userId", + "organizationId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "organizationsPeople_userId_users_id_fk": { + "name": "organizationsPeople_userId_users_id_fk", + "tableFrom": "organizationsPeople", + "tableTo": "users", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "organizationsPeople_organizationId_organizations_id_fk": { + "name": "organizationsPeople_organizationId_organizations_id_fk", + "tableFrom": "organizationsPeople", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "purgeAppArtifact": { + "name": "purgeAppArtifact", + "columns": { + "orgId": { + "name": "orgId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hasArtifact": { + "name": "hasArtifact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appName": { + "name": "appName", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch('subsecond') * 1000)" + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch('subsecond') * 1000)" + } + }, + "indexes": { + "idx_createdAt": { + "name": "idx_createdAt", + "columns": [ + "createdAt" + ], + "isUnique": false + }, + "idx_hasArtifact": { + "name": "idx_hasArtifact", + "columns": [ + "hasArtifact" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "purgeAppArtifact_orgId_appId_pk": { + "columns": [ + "orgId", + "appId" + ], + "name": "purgeAppArtifact_orgId_appId_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "providerUserId": { + "name": "providerUserId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "users_id_unique": { + "name": "users_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "users_providerUserId_unique": { + "name": "users_providerUserId_unique", + "columns": [ + "providerUserId" + ], + "isUnique": true + }, + "users_email_unique": { + "name": "users_email_unique", + "columns": [ + "email" + ], + "isUnique": true + }, + "providerUserId": { + "name": "providerUserId", + "columns": [ + "providerUserId" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/server/db/drizzle/meta/0049_snapshot.json b/server/db/drizzle/meta/0049_snapshot.json new file mode 100644 index 0000000..6d601cd --- /dev/null +++ b/server/db/drizzle/meta/0049_snapshot.json @@ -0,0 +1,898 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "9c047918-7efa-4deb-bfd0-cffd9caf2a08", + "prevId": "1dd5b490-b449-4ab4-a346-62013ab01d9a", + "tables": { + "apiKeys": { + "name": "apiKeys", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apiKeys_id_unique": { + "name": "apiKeys_id_unique", + "columns": [ + "id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "apiKeys_organizationId_organizations_id_fk": { + "name": "apiKeys_organizationId_organizations_id_fk", + "tableFrom": "apiKeys", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apiKeys_appsId_apps_id_fk": { + "name": "apiKeys_appsId_apps_id_fk", + "tableFrom": "apiKeys", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apps": { + "name": "apps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "osType": { + "name": "osType", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationsId": { + "name": "organizationsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apps_id_unique": { + "name": "apps_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "apps_organizationsId_name_unique": { + "name": "apps_organizationsId_name_unique", + "columns": [ + "organizationsId", + "name" + ], + "isUnique": true + } + }, + "foreignKeys": { + "apps_organizationsId_organizations_id_fk": { + "name": "apps_organizationsId_organizations_id_fk", + "tableFrom": "apps", + "tableTo": "organizations", + "columnsFrom": [ + "organizationsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifacts": { + "name": "artifacts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "fileObjectKey": { + "name": "fileObjectKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_object_apk_key": { + "name": "file_object_apk_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "versionName2": { + "name": "versionName2", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "versionCode2": { + "name": "versionCode2", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "releaseNotes": { + "name": "releaseNotes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "releaseId": { + "name": "releaseId", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "extension": { + "name": "extension", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "packageName": { + "name": "packageName", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "artifacts_id_unique": { + "name": "artifacts_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "artifacts_appsId_releaseId_unique": { + "name": "artifacts_appsId_releaseId_unique", + "columns": [ + "appsId", + "releaseId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifacts_appsId_apps_id_fk": { + "name": "artifacts_appsId_apps_id_fk", + "tableFrom": "artifacts", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "artifacts_organizationId_organizations_id_fk": { + "name": "artifacts_organizationId_organizations_id_fk", + "tableFrom": "artifacts", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifactsGroups": { + "name": "artifactsGroups", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publicId": { + "name": "publicId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "isPublic": { + "name": "isPublic", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "artifactsGroups_id_unique": { + "name": "artifactsGroups_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "artifactsGroups_appsId_name_unique": { + "name": "artifactsGroups_appsId_name_unique", + "columns": [ + "appsId", + "name" + ], + "isUnique": true + }, + "artifactsGroups_appsId_name_publicId_unique": { + "name": "artifactsGroups_appsId_name_publicId_unique", + "columns": [ + "appsId", + "name", + "publicId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifactsGroups_appsId_apps_id_fk": { + "name": "artifactsGroups_appsId_apps_id_fk", + "tableFrom": "artifactsGroups", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artifactsGroupsManager": { + "name": "artifactsGroupsManager", + "columns": { + "artifactsId": { + "name": "artifactsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifactsGroupsId": { + "name": "artifactsGroupsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "artifactsGroupsManager_artifactsId_artifactsGroupsId_unique": { + "name": "artifactsGroupsManager_artifactsId_artifactsGroupsId_unique", + "columns": [ + "artifactsId", + "artifactsGroupsId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artifactsGroupsManager_artifactsId_artifacts_id_fk": { + "name": "artifactsGroupsManager_artifactsId_artifacts_id_fk", + "tableFrom": "artifactsGroupsManager", + "tableTo": "artifacts", + "columnsFrom": [ + "artifactsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "artifactsGroupsManager_artifactsGroupsId_artifactsGroups_id_fk": { + "name": "artifactsGroupsManager_artifactsGroupsId_artifactsGroups_id_fk", + "tableFrom": "artifactsGroupsManager", + "tableTo": "artifactsGroups", + "columnsFrom": [ + "artifactsGroupsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "grouptester": { + "name": "grouptester", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "testerId": { + "name": "testerId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appsId": { + "name": "appsId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifactGroupId": { + "name": "artifactGroupId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "grouptester_id_unique": { + "name": "grouptester_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "testerId_orgId_appId_groupId": { + "name": "testerId_orgId_appId_groupId", + "columns": [ + "testerId", + "organizationId", + "appsId", + "artifactGroupId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "grouptester_testerId_users_id_fk": { + "name": "grouptester_testerId_users_id_fk", + "tableFrom": "grouptester", + "tableTo": "users", + "columnsFrom": [ + "testerId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_organizationId_organizations_id_fk": { + "name": "grouptester_organizationId_organizations_id_fk", + "tableFrom": "grouptester", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_appsId_apps_id_fk": { + "name": "grouptester_appsId_apps_id_fk", + "tableFrom": "grouptester", + "tableTo": "apps", + "columnsFrom": [ + "appsId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "grouptester_artifactGroupId_artifactsGroups_id_fk": { + "name": "grouptester_artifactGroupId_artifactsGroups_id_fk", + "tableFrom": "grouptester", + "tableTo": "artifactsGroups", + "columnsFrom": [ + "artifactGroupId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "organizations": { + "name": "organizations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organizations_id_unique": { + "name": "organizations_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "organizations_name_unique": { + "name": "organizations_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "organizationsPeople": { + "name": "organizationsPeople", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organizationsPeople_userId_organizationId_unique": { + "name": "organizationsPeople_userId_organizationId_unique", + "columns": [ + "userId", + "organizationId" + ], + "isUnique": true + } + }, + "foreignKeys": { + "organizationsPeople_userId_users_id_fk": { + "name": "organizationsPeople_userId_users_id_fk", + "tableFrom": "organizationsPeople", + "tableTo": "users", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "organizationsPeople_organizationId_organizations_id_fk": { + "name": "organizationsPeople_organizationId_organizations_id_fk", + "tableFrom": "organizationsPeople", + "tableTo": "organizations", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "purgeAppArtifact": { + "name": "purgeAppArtifact", + "columns": { + "orgId": { + "name": "orgId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hasArtifact": { + "name": "hasArtifact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appName": { + "name": "appName", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch('subsecond') * 1000)" + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch('subsecond') * 1000)" + } + }, + "indexes": { + "idx_createdAt": { + "name": "idx_createdAt", + "columns": [ + "createdAt" + ], + "isUnique": false + }, + "idx_hasArtifact": { + "name": "idx_hasArtifact", + "columns": [ + "hasArtifact" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "purgeAppArtifact_orgId_appId_pk": { + "columns": [ + "orgId", + "appId" + ], + "name": "purgeAppArtifact_orgId_appId_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "providerUserId": { + "name": "providerUserId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "users_id_unique": { + "name": "users_id_unique", + "columns": [ + "id" + ], + "isUnique": true + }, + "users_providerUserId_unique": { + "name": "users_providerUserId_unique", + "columns": [ + "providerUserId" + ], + "isUnique": true + }, + "users_email_unique": { + "name": "users_email_unique", + "columns": [ + "email" + ], + "isUnique": true + }, + "providerUserId": { + "name": "providerUserId", + "columns": [ + "providerUserId" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/server/db/drizzle/meta/_journal.json b/server/db/drizzle/meta/_journal.json index 495a7ce..2a5d5f8 100644 --- a/server/db/drizzle/meta/_journal.json +++ b/server/db/drizzle/meta/_journal.json @@ -337,6 +337,20 @@ "when": 1733353601093, "tag": "0047_solid_cassandra_nova", "breakpoints": true + }, + { + "idx": 48, + "version": "6", + "when": 1733354029190, + "tag": "0048_eager_vindicator", + "breakpoints": true + }, + { + "idx": 49, + "version": "6", + "when": 1733354584990, + "tag": "0049_open_shockwave", + "breakpoints": true } ] } \ No newline at end of file diff --git a/server/db/schema.ts b/server/db/schema.ts index 8dc1847..c0a8b2b 100644 --- a/server/db/schema.ts +++ b/server/db/schema.ts @@ -112,6 +112,9 @@ export const artifacts = sqliteTable('artifacts', { appsId: text('appsId').references(() => apps.id, { onDelete: 'set null', }), + organizationId: text('organizationId').references(() => organizations.id, { + onDelete: 'set null', + }), }, t => ({ appsId_releaseId: unique().on(t.appsId, t.releaseId), }))