refactor: migration

This commit is contained in:
Mauricio Siu
2025-02-09 18:56:17 -06:00
parent c04bf3c7e0
commit fafc238e70
22 changed files with 138 additions and 101 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ import { admins } from "./admin";
import { applications } from "./application";
import { compose } from "./compose";
import { server } from "./server";
import { users } from "./user";
import { user } from "./user";
export const sshKeys = pgTable("ssh-key", {
sshKeyId: text("sshKeyId")
@@ -22,7 +22,7 @@ export const sshKeys = pgTable("ssh-key", {
.notNull()
.$defaultFn(() => new Date().toISOString()),
lastUsedAt: text("lastUsedAt"),
userId: text("userId").references(() => users.id, {
userId: text("userId").references(() => user.id, {
onDelete: "cascade",
}),
});
@@ -31,9 +31,9 @@ export const sshKeysRelations = relations(sshKeys, ({ many, one }) => ({
applications: many(applications),
compose: many(compose),
servers: many(server),
user: one(users, {
user: one(user, {
fields: [sshKeys.userId],
references: [users.id],
references: [user.id],
}),
}));