@@ -269,82 +269,7 @@ else
269
269
bun scripts/manage-db.ts fix
270
270
fi
271
271
272
- # Run database migrations
273
- echo " Running database migrations..."
274
-
275
- # Update mirror_jobs table with new columns for resilience
276
- if [ -f " dist/scripts/update-mirror-jobs-table.js" ]; then
277
- echo " Updating mirror_jobs table..."
278
- bun dist/scripts/update-mirror-jobs-table.js
279
- elif [ -f " scripts/update-mirror-jobs-table.ts" ]; then
280
- echo " Updating mirror_jobs table using TypeScript script..."
281
- bun scripts/update-mirror-jobs-table.ts
282
- else
283
- echo " Warning: Could not find mirror_jobs table update script."
284
- fi
285
-
286
- # Run v3 migrations if needed
287
- echo " Checking for v3 migrations..."
288
-
289
- # Check if we need to run Better Auth migration (check if accounts table exists)
290
- if ! sqlite3 /app/data/gitea-mirror.db " SELECT name FROM sqlite_master WHERE type='table' AND name='accounts';" | grep -q accounts; then
291
- echo " 🔄 v3 Migration: Creating Better Auth tables..."
292
- # Create Better Auth tables
293
- sqlite3 /app/data/gitea-mirror.db << EOF
294
- CREATE TABLE IF NOT EXISTS accounts (
295
- id TEXT PRIMARY KEY,
296
- userId TEXT NOT NULL,
297
- accountId TEXT NOT NULL,
298
- providerId TEXT NOT NULL,
299
- accessToken TEXT,
300
- refreshToken TEXT,
301
- expiresAt INTEGER,
302
- password TEXT,
303
- createdAt INTEGER NOT NULL,
304
- updatedAt INTEGER NOT NULL,
305
- FOREIGN KEY (userId) REFERENCES users(id)
306
- );
307
-
308
- CREATE TABLE IF NOT EXISTS sessions (
309
- id TEXT PRIMARY KEY,
310
- userId TEXT NOT NULL,
311
- token TEXT NOT NULL,
312
- expiresAt INTEGER NOT NULL,
313
- createdAt INTEGER NOT NULL,
314
- updatedAt INTEGER NOT NULL,
315
- FOREIGN KEY (userId) REFERENCES users(id)
316
- );
317
-
318
- CREATE TABLE IF NOT EXISTS verification_tokens (
319
- id TEXT PRIMARY KEY,
320
- identifier TEXT NOT NULL,
321
- token TEXT NOT NULL,
322
- expires INTEGER NOT NULL
323
- );
324
-
325
- CREATE INDEX IF NOT EXISTS idx_accounts_userId ON accounts(userId);
326
- CREATE INDEX IF NOT EXISTS idx_sessions_token ON sessions(token);
327
- CREATE INDEX IF NOT EXISTS idx_verification_identifier_token ON verification_tokens(identifier, token);
328
- EOF
329
- fi
330
-
331
- # Run Better Auth user migration
332
- if [ -f " dist/scripts/migrate-better-auth.js" ]; then
333
- echo " 🔄 v3 Migration: Migrating users to Better Auth..."
334
- bun dist/scripts/migrate-better-auth.js
335
- elif [ -f " scripts/migrate-better-auth.ts" ]; then
336
- echo " 🔄 v3 Migration: Migrating users to Better Auth..."
337
- bun scripts/migrate-better-auth.ts
338
- fi
339
-
340
- # Run token encryption migration
341
- if [ -f " dist/scripts/migrate-tokens-encryption.js" ]; then
342
- echo " 🔄 v3 Migration: Encrypting stored tokens..."
343
- bun dist/scripts/migrate-tokens-encryption.js
344
- elif [ -f " scripts/migrate-tokens-encryption.ts" ]; then
345
- echo " 🔄 v3 Migration: Encrypting stored tokens..."
346
- bun scripts/migrate-tokens-encryption.ts
347
- fi
272
+ echo " Database exists, checking integrity..."
348
273
fi
349
274
350
275
# Extract version from package.json and set as environment variable
0 commit comments