Add checksum field and unique constraint on type_name

Added a new 'checksum' field with a length of 64 characters to ensure data integrity. Additionally, enforced uniqueness on the 'type_name' to prevent duplicate entries.
This commit is contained in:
Mathis H (Avnyr) 2024-09-24 12:28:53 +02:00
parent bdadf51e54
commit d42aaeda05
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -61,11 +61,14 @@ export const FilesTable = pgTable("files", {
}) })
.notNull(), .notNull(),
checksum: p.varchar("checksum", {
length: 64
}).notNull(),
uploader: p uploader: p
.varchar("uploader", { .varchar("uploader", {
length: 64, length: 64,
}) })
.default("anonyme")
.notNull(), .notNull(),
groupId: p groupId: p
@ -117,6 +120,7 @@ export const FilesTypesTable = pgTable("f_types", {
.varchar("type_name", { .varchar("type_name", {
length: 64, length: 64,
}) })
.unique()
.notNull(), .notNull(),
mime: p mime: p