From 00fb02dff45569623dde74739f9a0d0f30595410 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Sat, 4 Jul 2026 02:18:42 +0800 Subject: [PATCH] fix(file-service): add Flyway migration for pinned column, fix production crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit file-service uses ddl-auto=validate (Flyway-managed schema), not auto-DDL — the previous commit added a pinned field to FileEntity with no matching migration, so Hibernate schema validation failed at startup and crash-looped the service in production. Add V2__add_pinned.sql to actually create the column. Co-Authored-By: Claude Sonnet 5 --- file-service/src/main/java/com/xuqm/file/entity/FileEntity.java | 2 +- file-service/src/main/resources/db/migration/V2__add_pinned.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 file-service/src/main/resources/db/migration/V2__add_pinned.sql diff --git a/file-service/src/main/java/com/xuqm/file/entity/FileEntity.java b/file-service/src/main/java/com/xuqm/file/entity/FileEntity.java index bd143f9..100952d 100644 --- a/file-service/src/main/java/com/xuqm/file/entity/FileEntity.java +++ b/file-service/src/main/java/com/xuqm/file/entity/FileEntity.java @@ -46,7 +46,7 @@ public class FileEntity { * services (e.g. update-service) for files that must stay downloadable indefinitely, * such as APK packages, even if nobody re-downloads them for a long time. */ - @Column(name = "pinned", nullable = false) + @Column(name = "pinned", nullable = false, columnDefinition = "TINYINT(1) NOT NULL DEFAULT 0") private boolean pinned; public String getId() { return id; } diff --git a/file-service/src/main/resources/db/migration/V2__add_pinned.sql b/file-service/src/main/resources/db/migration/V2__add_pinned.sql new file mode 100644 index 0000000..e08c684 --- /dev/null +++ b/file-service/src/main/resources/db/migration/V2__add_pinned.sql @@ -0,0 +1,2 @@ +ALTER TABLE file_record + ADD COLUMN pinned TINYINT(1) NOT NULL DEFAULT 0;