mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(database): 🚚 Rename "Attachment" to "Media"
This commit is contained in:
parent
bbd56b600d
commit
2f61cd8f0a
21 changed files with 2429 additions and 101 deletions
4
drizzle/migrations/0041_bright_doctor_spectrum.sql
Normal file
4
drizzle/migrations/0041_bright_doctor_spectrum.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE "Attachments" RENAME TO "Medias";--> statement-breakpoint
|
||||
ALTER TABLE "Medias" DROP CONSTRAINT "Attachments_noteId_Notes_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "Medias" ADD CONSTRAINT "Medias_noteId_Notes_id_fk" FOREIGN KEY ("noteId") REFERENCES "public"."Notes"("id") ON DELETE cascade ON UPDATE cascade;
|
||||
2323
drizzle/migrations/meta/0041_snapshot.json
Normal file
2323
drizzle/migrations/meta/0041_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -288,6 +288,13 @@
|
|||
"when": 1735776034097,
|
||||
"tag": "0040_good_nocturne",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 41,
|
||||
"version": "7",
|
||||
"when": 1737644734501,
|
||||
"tag": "0041_bright_doctor_spectrum",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ export const Tokens = pgTable("Tokens", {
|
|||
}),
|
||||
});
|
||||
|
||||
export const Attachments = pgTable("Attachments", {
|
||||
export const Medias = pgTable("Medias", {
|
||||
id: id(),
|
||||
url: text("url").notNull(),
|
||||
remoteUrl: text("remote_url"),
|
||||
|
|
@ -799,9 +799,9 @@ export const UserToPinnedNotes = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const AttachmentsRelations = relations(Attachments, ({ one }) => ({
|
||||
export const AttachmentsRelations = relations(Medias, ({ one }) => ({
|
||||
notes: one(Notes, {
|
||||
fields: [Attachments.noteId],
|
||||
fields: [Medias.noteId],
|
||||
references: [Notes.id],
|
||||
}),
|
||||
}));
|
||||
|
|
@ -894,7 +894,7 @@ export const NotesRelations = relations(Notes, ({ many, one }) => ({
|
|||
references: [Users.id],
|
||||
relationName: "NoteToAuthor",
|
||||
}),
|
||||
attachments: many(Attachments),
|
||||
attachments: many(Medias),
|
||||
mentions: many(NoteToMentions),
|
||||
reblog: one(Notes, {
|
||||
fields: [Notes.reblogId],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue