feat: add migration

This commit is contained in:
Mauricio Siu
2025-02-09 18:19:21 -06:00
parent 6b9fd596e5
commit c04bf3c7e0
31 changed files with 5790 additions and 440 deletions

View File

@@ -7,6 +7,7 @@ import { admins } from "./admin";
import { bitbucket } from "./bitbucket";
import { github } from "./github";
import { gitlab } from "./gitlab";
import { users } from "./user";
export const gitProviderType = pgEnum("gitProviderType", [
"github",
@@ -24,7 +25,7 @@ export const gitProvider = pgTable("git_provider", {
createdAt: text("createdAt")
.notNull()
.$defaultFn(() => new Date().toISOString()),
adminId: text("adminId").references(() => admins.adminId, {
userId: text("userId").references(() => users.id, {
onDelete: "cascade",
}),
});
@@ -42,9 +43,9 @@ export const gitProviderRelations = relations(gitProvider, ({ one, many }) => ({
fields: [gitProvider.gitProviderId],
references: [bitbucket.gitProviderId],
}),
admin: one(admins, {
fields: [gitProvider.adminId],
references: [admins.adminId],
user: one(users, {
fields: [gitProvider.userId],
references: [users.id],
}),
}));