From 1a2452518c5c3e5436912ba0fae515539059ebd8 Mon Sep 17 00:00:00 2001 From: Rostislav Raykov Date: Tue, 18 Mar 2025 23:20:24 +0200 Subject: [PATCH] added migration for share token table --- .../migration/V3__Add_Share_Token_table.sql | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/main/resources/db/migration/V3__Add_Share_Token_table.sql b/src/main/resources/db/migration/V3__Add_Share_Token_table.sql index 150b82d..7dc1330 100644 --- a/src/main/resources/db/migration/V3__Add_Share_Token_table.sql +++ b/src/main/resources/db/migration/V3__Add_Share_Token_table.sql @@ -8,3 +8,42 @@ CREATE TABLE IF NOT EXISTS share_token_entity CONSTRAINT fk_file FOREIGN KEY (file_id) REFERENCES file_entity (id) ); +-- Removing share_token and token_expiration_date columns + +ALTER TABLE file_entity + RENAME TO file_entity_old; + +CREATE TABLE file_entity +( + id INTEGER PRIMARY KEY AUTOINCREMENT, + description VARCHAR(255), + keep_indefinitely BOOLEAN, + name VARCHAR(255), + size BIGINT, + upload_date DATE, + uuid VARCHAR(255), + password_hash VARCHAR(255), + hidden BOOLEAN DEFAULT FALSE +); + +INSERT INTO file_entity (id, + description, + keep_indefinitely, + name, + size, + upload_date, + uuid, + password_hash, + hidden) +SELECT id, + description, + keep_indefinitely, + name, + size, + upload_date, + uuid, + password_hash, + hidden +FROM file_entity_old; + +DROP TABLE file_entity_old; \ No newline at end of file