mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-07 08:26:00 +00:00
Merge pull request #11 from iflytek/fix/storage-permission-and-audit-log-jsonb
fix(ops): resolve storage permission and audit log JSONB type issues
This commit is contained in:
commit
987fa80bbf
3 changed files with 20 additions and 2 deletions
|
|
@ -24,7 +24,10 @@ WORKDIR /app
|
|||
|
||||
COPY --from=build /app/skillhub-app/target/*.jar app.jar
|
||||
|
||||
RUN chown -R app:app /app
|
||||
# Create storage directory and set permissions
|
||||
RUN mkdir -p /var/lib/skillhub/storage && \
|
||||
chown -R app:app /app /var/lib/skillhub/storage
|
||||
|
||||
USER app
|
||||
|
||||
EXPOSE 8080
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
-- Fix audit_log detail_json column to properly handle JSONB type
|
||||
-- This migration ensures existing data is compatible with the JSONB type
|
||||
|
||||
-- The column is already defined as jsonb in V1, but we need to ensure
|
||||
-- any existing string data can be properly cast to jsonb
|
||||
ALTER TABLE audit_log
|
||||
ALTER COLUMN detail_json TYPE jsonb
|
||||
USING CASE
|
||||
WHEN detail_json IS NULL THEN NULL
|
||||
WHEN detail_json = '' THEN NULL
|
||||
ELSE detail_json::jsonb
|
||||
END;
|
||||
|
|
@ -7,6 +7,8 @@ import jakarta.persistence.GenerationType;
|
|||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.PrePersist;
|
||||
import jakarta.persistence.Table;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import java.time.Instant;
|
||||
|
||||
@Entity
|
||||
|
|
@ -38,7 +40,8 @@ public class AuditLog {
|
|||
@Column(name = "user_agent", length = 512)
|
||||
private String userAgent;
|
||||
|
||||
@Column(name = "detail_json", columnDefinition = "jsonb")
|
||||
@Column(name = "detail_json")
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
private String detailJson;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue