Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- CreateTable
CREATE TABLE "DeploymentInternalValueSource" (
"id" UUID NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deploymentSourceId" UUID NOT NULL,
"order" INTEGER NOT NULL,
"path" TEXT NOT NULL DEFAULT '',

CONSTRAINT "DeploymentInternalValueSource_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "DeploymentExternalValueSource" (
"id" UUID NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deploymentSourceId" UUID NOT NULL,
"order" INTEGER NOT NULL,
"path" TEXT NOT NULL DEFAULT '',
"ref" TEXT NOT NULL,
"targetRevision" TEXT NOT NULL DEFAULT '',
"repositoryId" UUID NOT NULL,

CONSTRAINT "DeploymentExternalValueSource_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentInternalValueSource_id_key" ON "DeploymentInternalValueSource"("id");

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentExternalValueSource_id_key" ON "DeploymentExternalValueSource"("id");

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentExternalValueSource_deploymentSourceId_key" ON "DeploymentExternalValueSource"("deploymentSourceId");

-- AddForeignKey
ALTER TABLE "DeploymentInternalValueSource" ADD CONSTRAINT "DeploymentInternalValueSource_deploymentSourceId_fkey" FOREIGN KEY ("deploymentSourceId") REFERENCES "DeploymentSource"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DeploymentExternalValueSource" ADD CONSTRAINT "DeploymentExternalValueSource_deploymentSourceId_fkey" FOREIGN KEY ("deploymentSourceId") REFERENCES "DeploymentSource"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DeploymentExternalValueSource" ADD CONSTRAINT "DeploymentExternalValueSource_repositoryId_fkey" FOREIGN KEY ("repositoryId") REFERENCES "Repository"("id") ON DELETE CASCADE ON UPDATE CASCADE;
77 changes: 52 additions & 25 deletions apps/server-nestjs/src/prisma/schema/project.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,43 @@ model Deployment {
}

model DeploymentSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentId String @db.Uuid
repositoryId String @db.Uuid
type DeploymentSourceType
targetRevision String @default("")
path String @default("")
helmValuesFiles String @default("")
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
deployment Deployment @relation(fields: [deploymentId], references: [id], onDelete: Cascade)
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentId String @db.Uuid
repositoryId String @db.Uuid
type DeploymentSourceType
targetRevision String @default("")
path String @default("")
helmValuesFiles String @default("")
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
deployment Deployment @relation(fields: [deploymentId], references: [id], onDelete: Cascade)
internalValueSources DeploymentInternalValueSource[]
externalValueSource DeploymentExternalValueSource?
}

model DeploymentInternalValueSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentSourceId String @db.Uuid
order Int
path String @default("")
deploymentSource DeploymentSource @relation(fields: [deploymentSourceId], references: [id], onDelete: Cascade)
}

model DeploymentExternalValueSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentSourceId String @unique @db.Uuid
order Int
path String @default("")
ref String
targetRevision String @default("")
repositoryId String @db.Uuid
deploymentSource DeploymentSource @relation(fields: [deploymentSourceId], references: [id], onDelete: Cascade)
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
}

model Environment {
Expand All @@ -46,20 +72,21 @@ model Environment {
}

model Repository {
id String @id @default(uuid()) @db.Uuid
projectId String @db.Uuid
internalRepoName String
externalRepoUrl String @default("")
externalUserName String @default("")
isInfra Boolean @default(false)
isPrivate Boolean @default(false)
deployRevision String @default("")
deployPath String @default("")
helmValuesFiles String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
deploymentSources DeploymentSource[]
id String @id @default(uuid()) @db.Uuid
projectId String @db.Uuid
internalRepoName String
externalRepoUrl String @default("")
externalUserName String @default("")
isInfra Boolean @default(false)
isPrivate Boolean @default(false)
deployRevision String @default("")
deployPath String @default("")
helmValuesFiles String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
deploymentSources DeploymentSource[]
deploymentExternalValueSources DeploymentExternalValueSource[]
}

model ProjectClusterHistory {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- CreateTable
CREATE TABLE "DeploymentInternalValueSource" (
"id" UUID NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deploymentSourceId" UUID NOT NULL,
"order" INTEGER NOT NULL,
"path" TEXT NOT NULL DEFAULT '',

CONSTRAINT "DeploymentInternalValueSource_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "DeploymentExternalValueSource" (
"id" UUID NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deploymentSourceId" UUID NOT NULL,
"order" INTEGER NOT NULL,
"path" TEXT NOT NULL DEFAULT '',
"ref" TEXT NOT NULL,
"targetRevision" TEXT NOT NULL DEFAULT '',
"repositoryId" UUID NOT NULL,

CONSTRAINT "DeploymentExternalValueSource_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentInternalValueSource_id_key" ON "DeploymentInternalValueSource"("id");

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentExternalValueSource_id_key" ON "DeploymentExternalValueSource"("id");

-- CreateIndex
CREATE UNIQUE INDEX "DeploymentExternalValueSource_deploymentSourceId_key" ON "DeploymentExternalValueSource"("deploymentSourceId");

-- AddForeignKey
ALTER TABLE "DeploymentInternalValueSource" ADD CONSTRAINT "DeploymentInternalValueSource_deploymentSourceId_fkey" FOREIGN KEY ("deploymentSourceId") REFERENCES "DeploymentSource"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DeploymentExternalValueSource" ADD CONSTRAINT "DeploymentExternalValueSource_deploymentSourceId_fkey" FOREIGN KEY ("deploymentSourceId") REFERENCES "DeploymentSource"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "DeploymentExternalValueSource" ADD CONSTRAINT "DeploymentExternalValueSource_repositoryId_fkey" FOREIGN KEY ("repositoryId") REFERENCES "Repository"("id") ON DELETE CASCADE ON UPDATE CASCADE;
77 changes: 52 additions & 25 deletions apps/server/src/prisma/schema/project.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,43 @@ model Deployment {
}

model DeploymentSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentId String @db.Uuid
repositoryId String @db.Uuid
type DeploymentSourceType
targetRevision String @default("")
path String @default("")
helmValuesFiles String @default("")
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
deployment Deployment @relation(fields: [deploymentId], references: [id], onDelete: Cascade)
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentId String @db.Uuid
repositoryId String @db.Uuid
type DeploymentSourceType
targetRevision String @default("")
path String @default("")
helmValuesFiles String @default("")
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
deployment Deployment @relation(fields: [deploymentId], references: [id], onDelete: Cascade)
internalValueSources DeploymentInternalValueSource[]
externalValueSource DeploymentExternalValueSource?
}

model DeploymentInternalValueSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentSourceId String @db.Uuid
order Int
path String @default("")
deploymentSource DeploymentSource @relation(fields: [deploymentSourceId], references: [id], onDelete: Cascade)
}

model DeploymentExternalValueSource {
id String @id @unique @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deploymentSourceId String @unique @db.Uuid
order Int
path String @default("")
ref String
targetRevision String @default("")
repositoryId String @db.Uuid
deploymentSource DeploymentSource @relation(fields: [deploymentSourceId], references: [id], onDelete: Cascade)
repository Repository @relation(fields: [repositoryId], references: [id], onDelete: Cascade)
}

model Environment {
Expand All @@ -46,20 +72,21 @@ model Environment {
}

model Repository {
id String @id @default(uuid()) @db.Uuid
projectId String @db.Uuid
internalRepoName String
externalRepoUrl String @default("")
externalUserName String @default("")
isInfra Boolean @default(false)
isPrivate Boolean @default(false)
deployRevision String @default("")
deployPath String @default("")
helmValuesFiles String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
deploymentSources DeploymentSource[]
id String @id @default(uuid()) @db.Uuid
projectId String @db.Uuid
internalRepoName String
externalRepoUrl String @default("")
externalUserName String @default("")
isInfra Boolean @default(false)
isPrivate Boolean @default(false)
deployRevision String @default("")
deployPath String @default("")
helmValuesFiles String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
deploymentSources DeploymentSource[]
deploymentExternalValueSources DeploymentExternalValueSource[]
}

model ProjectClusterHistory {
Expand Down
2 changes: 2 additions & 0 deletions packages/test-utils/src/imports/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2302,4 +2302,6 @@ export const data = {
],
deployment: [],
deploymentSource: [],
deploymentExternalValueSource: [],
deploymentInternalValueSource: [],
}