diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0a649e0..4e25c3e 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -120,161 +120,13 @@ fi # Dependencies are already installed during the Docker build process # Initialize the database if it doesn't exist +# Note: Drizzle migrations will be run automatically when the app starts (see src/lib/db/index.ts) if [ ! -f "/app/data/gitea-mirror.db" ]; then - echo "Initializing database..." - if [ -f "dist/scripts/init-db.js" ]; then - bun dist/scripts/init-db.js - elif [ -f "dist/scripts/manage-db.js" ]; then - bun dist/scripts/manage-db.js init - elif [ -f "scripts/manage-db.ts" ]; then - bun scripts/manage-db.ts init - else - echo "Warning: Could not find database initialization scripts in dist/scripts." - echo "Creating and initializing database manually..." - - # Create the database file - touch /app/data/gitea-mirror.db - - # Initialize the database with required tables - sqlite3 /app/data/gitea-mirror.db < statement-breakpoint +-- Step 2: Now create the unique index safely +CREATE UNIQUE INDEX uniq_repositories_user_full_name ON repositories (user_id, full_name); \ No newline at end of file