feat: add hash and thumbnail columns to file, sort column and order method to manifestattachment

This commit is contained in:
seb
2026-09-18 01:21:54 +02:00
parent 980eda629b
commit cfb7f86f0e
11 changed files with 378 additions and 104 deletions

View File

@@ -773,9 +773,13 @@ IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'file')
BEGIN
CREATE TABLE [file] (
id INT IDENTITY(1,1) PRIMARY KEY,
hash NVARCHAR(64) NOT NULL,
mimetype NVARCHAR(255) NOT NULL,
name NVARCHAR(255) NOT NULL,
content VARBINARY(MAX) NOT NULL
content VARBINARY(MAX) NOT NULL,
thumbavif VARBINARY(MAX) NULL,
thumbx INT NULL,
thumby INT NULL
);
END
`;
@@ -787,8 +791,10 @@ BEGIN
id INT IDENTITY(1,1) PRIMARY KEY,
manifest_id INT NOT NULL,
file_id INT NOT NULL,
sort INT NOT NULL CONSTRAINT DF_manifestattachment_sort DEFAULT 0,
CONSTRAINT FK_manifestattachment_manifest FOREIGN KEY (manifest_id) REFERENCES manifest(id) ON DELETE CASCADE,
CONSTRAINT FK_manifestattachment_file FOREIGN KEY (file_id) REFERENCES [file](id) ON DELETE CASCADE
CONSTRAINT FK_manifestattachment_file FOREIGN KEY (file_id) REFERENCES [file](id) ON DELETE CASCADE,
CONSTRAINT UQ_manifestattachment_manifest_sort UNIQUE (manifest_id, sort)
);
END
`;