mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor(database): 🚚 Rename Application to Client everywhere
This commit is contained in:
parent
6f97903f3b
commit
1a0a27bee1
25 changed files with 2549 additions and 90 deletions
|
|
@ -0,0 +1,15 @@
|
|||
ALTER TABLE "Applications" RENAME TO "Clients";--> statement-breakpoint
|
||||
ALTER TABLE "Notes" RENAME COLUMN "applicationId" TO "clientId";--> statement-breakpoint
|
||||
ALTER TABLE "OpenIdLoginFlows" RENAME COLUMN "applicationId" TO "clientId";--> statement-breakpoint
|
||||
ALTER TABLE "AuthorizationCodes" DROP CONSTRAINT "AuthorizationCodes_clientId_Applications_client_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "Notes" DROP CONSTRAINT "Notes_applicationId_Applications_client_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "OpenIdLoginFlows" DROP CONSTRAINT "OpenIdLoginFlows_applicationId_Applications_client_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "Tokens" DROP CONSTRAINT "Tokens_clientId_Applications_client_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "AuthorizationCodes" ADD CONSTRAINT "AuthorizationCodes_clientId_Clients_client_id_fk" FOREIGN KEY ("clientId") REFERENCES "public"."Clients"("client_id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
|
||||
ALTER TABLE "Notes" ADD CONSTRAINT "Notes_clientId_Clients_client_id_fk" FOREIGN KEY ("clientId") REFERENCES "public"."Clients"("client_id") ON DELETE set null ON UPDATE cascade;--> statement-breakpoint
|
||||
ALTER TABLE "OpenIdLoginFlows" ADD CONSTRAINT "OpenIdLoginFlows_clientId_Clients_client_id_fk" FOREIGN KEY ("clientId") REFERENCES "public"."Clients"("client_id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
|
||||
ALTER TABLE "Tokens" ADD CONSTRAINT "Tokens_clientId_Clients_client_id_fk" FOREIGN KEY ("clientId") REFERENCES "public"."Clients"("client_id") ON DELETE cascade ON UPDATE cascade;
|
||||
2439
packages/kit/tables/migrations/meta/0052_snapshot.json
Normal file
2439
packages/kit/tables/migrations/meta/0052_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -365,6 +365,13 @@
|
|||
"when": 1755729662013,
|
||||
"tag": "0051_stiff_morbius",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 52,
|
||||
"version": "7",
|
||||
"when": 1755732000165,
|
||||
"tag": "0052_complete_hellfire_club",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ export const RelationshipsRelations = relations(Relationships, ({ one }) => ({
|
|||
}),
|
||||
}));
|
||||
|
||||
export const Clients = pgTable("Applications", {
|
||||
export const Clients = pgTable("Clients", {
|
||||
id: text("client_id").primaryKey(),
|
||||
secret: text("secret").notNull(),
|
||||
redirectUris: text("redirect_uris")
|
||||
|
|
@ -494,7 +494,7 @@ export const Notes = pgTable("Notes", {
|
|||
}),
|
||||
sensitive: boolean("sensitive").notNull().default(false),
|
||||
spoilerText: text("spoiler_text").default("").notNull(),
|
||||
applicationId: text("applicationId").references(() => Clients.id, {
|
||||
clientId: text("clientId").references(() => Clients.id, {
|
||||
onDelete: "set null",
|
||||
onUpdate: "cascade",
|
||||
}),
|
||||
|
|
@ -528,8 +528,8 @@ export const NotesRelations = relations(Notes, ({ many, one }) => ({
|
|||
references: [Notes.id],
|
||||
relationName: "NoteToQuotes",
|
||||
}),
|
||||
application: one(Clients, {
|
||||
fields: [Notes.applicationId],
|
||||
client: one(Clients, {
|
||||
fields: [Notes.clientId],
|
||||
references: [Clients.id],
|
||||
}),
|
||||
quotes: many(Notes, {
|
||||
|
|
@ -703,7 +703,7 @@ export const OpenIdLoginFlows = pgTable("OpenIdLoginFlows", {
|
|||
clientState: text("client_state"),
|
||||
clientRedirectUri: text("client_redirect_uri"),
|
||||
clientScopes: text("client_scopes").array(),
|
||||
applicationId: text("applicationId").references(() => Clients.id, {
|
||||
clientId: text("clientId").references(() => Clients.id, {
|
||||
onDelete: "cascade",
|
||||
onUpdate: "cascade",
|
||||
}),
|
||||
|
|
@ -713,8 +713,8 @@ export const OpenIdLoginFlows = pgTable("OpenIdLoginFlows", {
|
|||
export const OpenIdLoginFlowsRelations = relations(
|
||||
OpenIdLoginFlows,
|
||||
({ one }) => ({
|
||||
application: one(Clients, {
|
||||
fields: [OpenIdLoginFlows.applicationId],
|
||||
client: one(Clients, {
|
||||
fields: [OpenIdLoginFlows.clientId],
|
||||
references: [Clients.id],
|
||||
}),
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue