mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-03 21:15:23 +02:00
feat: add providers to compose
This commit is contained in:
@@ -138,6 +138,7 @@ export const applications = pgTable("application", {
|
||||
gitlabOwner: text("gitlabOwner"),
|
||||
gitlabBranch: text("gitlabBranch"),
|
||||
gitlabBuildPath: text("gitlabBuildPath").default("/"),
|
||||
gitlabPathNamespace: text("gitlabPathNamespace"),
|
||||
// Bitbucket
|
||||
bitbucketRepository: text("bitbucketRepository"),
|
||||
bitbucketOwner: text("bitbucketOwner"),
|
||||
@@ -423,6 +424,7 @@ export const apiSaveGitlabProvider = createSchema
|
||||
gitlabRepository: true,
|
||||
gitlabId: true,
|
||||
gitlabProjectId: true,
|
||||
gitlabPathNamespace: true,
|
||||
})
|
||||
.required();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { sshKeys } from "@/server/db/schema/ssh-key";
|
||||
import { relations } from "drizzle-orm";
|
||||
import { boolean, pgEnum, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { boolean, integer, pgEnum, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { nanoid } from "nanoid";
|
||||
import { z } from "zod";
|
||||
@@ -10,10 +10,17 @@ import { mounts } from "./mount";
|
||||
import { projects } from "./project";
|
||||
import { applicationStatus } from "./shared";
|
||||
import { generateAppName } from "./utils";
|
||||
import {
|
||||
bitbucketProvider,
|
||||
githubProvider,
|
||||
gitlabProvider,
|
||||
} from "./git-provider";
|
||||
|
||||
export const sourceTypeCompose = pgEnum("sourceTypeCompose", [
|
||||
"git",
|
||||
"github",
|
||||
"gitlab",
|
||||
"bitbucket",
|
||||
"raw",
|
||||
]);
|
||||
|
||||
@@ -39,6 +46,16 @@ export const compose = pgTable("compose", {
|
||||
owner: text("owner"),
|
||||
branch: text("branch"),
|
||||
autoDeploy: boolean("autoDeploy").$defaultFn(() => true),
|
||||
// Gitlab
|
||||
gitlabProjectId: integer("gitlabProjectId"),
|
||||
gitlabRepository: text("gitlabRepository"),
|
||||
gitlabOwner: text("gitlabOwner"),
|
||||
gitlabBranch: text("gitlabBranch"),
|
||||
gitlabPathNamespace: text("gitlabPathNamespace"),
|
||||
// Bitbucket
|
||||
bitbucketRepository: text("bitbucketRepository"),
|
||||
bitbucketOwner: text("bitbucketOwner"),
|
||||
bitbucketBranch: text("bitbucketBranch"),
|
||||
// Git
|
||||
customGitUrl: text("customGitUrl"),
|
||||
customGitBranch: text("customGitBranch"),
|
||||
@@ -48,7 +65,6 @@ export const compose = pgTable("compose", {
|
||||
onDelete: "set null",
|
||||
},
|
||||
),
|
||||
//
|
||||
command: text("command").notNull().default(""),
|
||||
//
|
||||
composePath: text("composePath").notNull().default("./docker-compose.yml"),
|
||||
@@ -59,6 +75,19 @@ export const compose = pgTable("compose", {
|
||||
createdAt: text("createdAt")
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date().toISOString()),
|
||||
|
||||
githubId: text("githubId").references(() => githubProvider.githubId, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
gitlabId: text("gitlabId").references(() => gitlabProvider.gitlabId, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
bitbucketId: text("bitbucketId").references(
|
||||
() => bitbucketProvider.bitbucketId,
|
||||
{
|
||||
onDelete: "set null",
|
||||
},
|
||||
),
|
||||
});
|
||||
|
||||
export const composeRelations = relations(compose, ({ one, many }) => ({
|
||||
@@ -73,6 +102,18 @@ export const composeRelations = relations(compose, ({ one, many }) => ({
|
||||
references: [sshKeys.sshKeyId],
|
||||
}),
|
||||
domains: many(domains),
|
||||
githubProvider: one(githubProvider, {
|
||||
fields: [compose.githubId],
|
||||
references: [githubProvider.githubId],
|
||||
}),
|
||||
gitlabProvider: one(gitlabProvider, {
|
||||
fields: [compose.gitlabId],
|
||||
references: [gitlabProvider.gitlabId],
|
||||
}),
|
||||
bitbucketProvider: one(bitbucketProvider, {
|
||||
fields: [compose.bitbucketId],
|
||||
references: [bitbucketProvider.bitbucketId],
|
||||
}),
|
||||
}));
|
||||
|
||||
const createSchema = createInsertSchema(compose, {
|
||||
|
||||
@@ -64,7 +64,7 @@ export const githubProvider = pgTable("github_provider", {
|
||||
|
||||
export const githubProviderRelations = relations(
|
||||
githubProvider,
|
||||
({ one, many }) => ({
|
||||
({ one, }) => ({
|
||||
gitProvider: one(gitProvider, {
|
||||
fields: [githubProvider.gitProviderId],
|
||||
references: [gitProvider.gitProviderId],
|
||||
@@ -91,7 +91,7 @@ export const gitlabProvider = pgTable("gitlab_provider", {
|
||||
|
||||
export const gitlabProviderRelations = relations(
|
||||
gitlabProvider,
|
||||
({ one, many }) => ({
|
||||
({ one}) => ({
|
||||
gitProvider: one(gitProvider, {
|
||||
fields: [gitlabProvider.gitProviderId],
|
||||
references: [gitProvider.gitProviderId],
|
||||
@@ -114,7 +114,7 @@ export const bitbucketProvider = pgTable("bitbucket_provider", {
|
||||
|
||||
export const bitbucketProviderRelations = relations(
|
||||
bitbucketProvider,
|
||||
({ one, many }) => ({
|
||||
({ one }) => ({
|
||||
gitProvider: one(gitProvider, {
|
||||
fields: [bitbucketProvider.gitProviderId],
|
||||
references: [gitProvider.gitProviderId],
|
||||
|
||||
Reference in New Issue
Block a user