Add groupId column and FilesGroupTable schema

Added the `groupId` column to the existing table to link with the new `FilesGroupTable`. The `FilesGroupTable` includes a unique identifier and a unique group name to manage file groups effectively.
This commit is contained in:
Mathis H (Avnyr) 2024-09-02 15:50:48 +02:00
parent d4a224614e
commit f2a45ce271
No known key found for this signature in database
GPG Key ID: FF69BF8BF95CDD58

View File

@ -68,6 +68,10 @@ export const FilesTable = pgTable("files", {
.default("anonyme")
.notNull(),
groupId: p
.uuid("group_id")
.references(()=> FilesGroupTable.uuid),
fileSize: p.integer("file_size").notNull(),
//TODO Replace by file type reference
@ -92,6 +96,18 @@ export const FilesTable = pgTable("files", {
.notNull(),
});
export const FilesGroupTable = pgTable("f_groups", {
// Unique identifier on a technical aspect.
uuid: p.uuid("uuid").unique().primaryKey().defaultRandom().notNull(),
groupName: p
.varchar("group_name", {
length: 64,
})
.unique()
.notNull(),
})
//TODO Files types
export const FilesTypesTable = pgTable("f_types", {
//uuid