From 9ec0f0e0d6c0c5ac3a30ad8fe8a705a4fba1553f Mon Sep 17 00:00:00 2001 From: Jared Wolff Date: Tue, 10 Mar 2026 21:17:34 -0400 Subject: [PATCH 1/2] fix(migrations): add ALTER TABLE fallback for media_sort_date column When the storage.files table already exists from a manual migration, CREATE TABLE IF NOT EXISTS is skipped entirely, so the new media_sort_date column is never added. Add an ALTER TABLE ADD COLUMN IF NOT EXISTS immediately after the CREATE TABLE to handle both fresh and pre-existing databases. Co-Authored-By: Claude Opus 4.6 --- migrations/20260307000000_initial_schema.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migrations/20260307000000_initial_schema.sql b/migrations/20260307000000_initial_schema.sql index 4bcff713..8ff235ab 100755 --- a/migrations/20260307000000_initial_schema.sql +++ b/migrations/20260307000000_initial_schema.sql @@ -560,6 +560,10 @@ CREATE TABLE IF NOT EXISTS storage.files ( media_sort_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP ); +-- Ensure media_sort_date exists on pre-existing tables (CREATE TABLE IF NOT EXISTS skips it) +ALTER TABLE storage.files ADD COLUMN IF NOT EXISTS + media_sort_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP; + -- A user cannot have two non-trashed files with the same name in the same folder CREATE UNIQUE INDEX IF NOT EXISTS idx_files_unique_name_in_folder ON storage.files(folder_id, name, user_id) WHERE NOT is_trashed AND folder_id IS NOT NULL; From a0ee538cb7a6a8f59f17a5c19cde4908e49f9db1 Mon Sep 17 00:00:00 2001 From: Jared Wolff Date: Tue, 10 Mar 2026 21:24:49 -0400 Subject: [PATCH 2/2] fix(docker): remove target-cpu=native from Dockerfile target-cpu=native causes SIGILL in CI because the build script is compiled with CPU-specific instructions that the Docker builder doesn't support. Docker images should use generic CPU targets for portability. Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c5b81db..a8269136 100755 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ COPY static static # Create a minimal project to download and cache dependencies RUN mkdir -p src && \ echo 'fn main() { println!("Dummy build for caching dependencies"); }' > src/main.rs && \ - RUSTFLAGS="-C target-cpu=native" cargo build --release && \ + cargo build --release && \ rm -rf src static-dist target/release/deps/oxicloud* target/release/build/oxicloud-* # Stage 2: Build the application FROM rust:1.94.0-alpine3.23 AS builder @@ -27,7 +27,7 @@ COPY static static COPY migrations migrations # Build with all optimizations (DATABASE_URL only needed at compile-time for sqlx) ARG DATABASE_URL="postgres://postgres:postgres@localhost/oxicloud" -RUN DATABASE_URL="${DATABASE_URL}" RUSTFLAGS="-C target-cpu=native" cargo build --release +RUN DATABASE_URL="${DATABASE_URL}" cargo build --release # Stage 3: Create minimal final image FROM alpine:3.23.3