[GH-ISSUE #45] V3 upgrade issues on docker. #3600

Closed
opened 2026-06-01 22:02:10 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @Cibbi on GitHub (Jul 18, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/45

Hi!

when upgrading to v3, the database migration fails

gitea-mirror  | 2025-07-18T13:54:18.498027090Z No custom CA certificates found in /app/certs
gitea-mirror  | 2025-07-18T13:54:18.501236860Z System CA bundle mounted, configuring Node.js to use it...
gitea-mirror  | 2025-07-18T13:54:18.501270098Z NODE_EXTRA_CA_CERTS set to: /etc/ssl/certs/ca-certificates.crt
gitea-mirror  | 2025-07-18T13:54:18.501399924Z Using previously generated BETTER_AUTH_SECRET
gitea-mirror  | 2025-07-18T13:54:18.502118901Z BETTER_AUTH_SECRET has been set to a secure random value
gitea-mirror  | 2025-07-18T13:54:18.502177088Z Using previously generated ENCRYPTION_SECRET
gitea-mirror  | 2025-07-18T13:54:18.502894868Z ENCRYPTION_SECRET has been set to a secure random value
gitea-mirror  | 2025-07-18T13:54:18.503293190Z Database already exists, checking for issues...
gitea-mirror  | 2025-07-18T13:54:18.601723514Z 🔧 Fixing database location issues...
gitea-mirror  | 2025-07-18T13:54:18.601773162Z ✅ Database location fixed
gitea-mirror  | 2025-07-18T13:54:18.605041931Z Running database migrations...
gitea-mirror  | 2025-07-18T13:54:18.605077395Z Warning: Could not find mirror_jobs table update script.
gitea-mirror  | 2025-07-18T13:54:18.605083988Z Checking for v3 migrations...
gitea-mirror  | 2025-07-18T13:54:18.607738079Z 🔄 v3 Migration: Creating Better Auth tables...
gitea-mirror  | 2025-07-18T13:54:18.621807704Z 🔄 v3 Migration: Migrating users to Better Auth...
gitea-mirror  | 2025-07-18T13:54:18.733013368Z Successfully connected to SQLite database using Bun's native driver
gitea-mirror  | 2025-07-18T13:54:18.733351203Z 🔄 Checking for pending migrations...
gitea-mirror  | 2025-07-18T13:54:18.740074046Z ❌ Error running migrations: 2149 | }
gitea-mirror  | 2025-07-18T13:54:18.740113575Z 2150 | 
gitea-mirror  | 2025-07-18T13:54:18.740118509Z 2151 | // node_modules/drizzle-orm/errors.js
gitea-mirror  | 2025-07-18T13:54:18.740122365Z 2152 | class DrizzleError extends Error {
gitea-mirror  | 2025-07-18T13:54:18.740126309Z 2153 |   static [entityKind] = "DrizzleError";
gitea-mirror  | 2025-07-18T13:54:18.740130176Z 2154 |     super(message);
gitea-mirror  | 2025-07-18T13:54:18.740133888Z            ^
gitea-mirror  | 2025-07-18T13:54:18.740137533Z DrizzleError: Failed to run the query 'CREATE TABLE `accounts` (
gitea-mirror  | 2025-07-18T13:54:18.740141291Z 	`id` text PRIMARY KEY NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740145161Z 	`account_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740148861Z 	`user_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740152593Z 	`provider_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740156418Z 	`provider_user_id` text,
gitea-mirror  | 2025-07-18T13:54:18.740160130Z 	`access_token` text,
gitea-mirror  | 2025-07-18T13:54:18.740164020Z 	`refresh_token` text,
gitea-mirror  | 2025-07-18T13:54:18.740167715Z 	`expires_at` integer,
gitea-mirror  | 2025-07-18T13:54:18.740171357Z 	`password` text,
gitea-mirror  | 2025-07-18T13:54:18.740175313Z 	`created_at` integer DEFAULT (unixepoch()) NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740179024Z 	`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740182706Z 	FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
gitea-mirror  | 2025-07-18T13:54:18.740200898Z );
gitea-mirror  | 2025-07-18T13:54:18.740206401Z '
gitea-mirror  | 2025-07-18T13:54:18.740210147Z       at new DrizzleError (/app/dist/scripts/migrate-better-auth.js:2154:5)
gitea-mirror  | 2025-07-18T13:54:18.740214089Z       at run (/app/dist/scripts/migrate-better-auth.js:3739:13)
gitea-mirror  | 2025-07-18T13:54:18.740217861Z       at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24)
gitea-mirror  | 2025-07-18T13:54:18.740221630Z       at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21)
gitea-mirror  | 2025-07-18T13:54:18.740225390Z       at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14)
gitea-mirror  | 2025-07-18T13:54:18.740229159Z       at /app/dist/scripts/migrate-better-auth.js:15500:23
gitea-mirror  | 2025-07-18T13:54:18.740232829Z       at loadAndEvaluateModule (1:11)
gitea-mirror  | 2025-07-18T13:54:18.740236812Z 
gitea-mirror  | 2025-07-18T13:54:18.740240407Z 308 |     if (params.length === 0)
gitea-mirror  | 2025-07-18T13:54:18.740244026Z 309 |       return SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query), createChangesObject();
gitea-mirror  | 2025-07-18T13:54:18.740247838Z 310 |     var arg0 = params[0];
gitea-mirror  | 2025-07-18T13:54:18.740251556Z 311 |     return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0)) ? SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, params) : SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, ...params), createChangesObject();
gitea-mirror  | 2025-07-18T13:54:18.740256116Z 312 |   }
gitea-mirror  | 2025-07-18T13:54:18.740259681Z 313 |     return new Statement(SQL.prepare(this.#handle, query, params, flags || 0, this.#internalFlags));
gitea-mirror  | 2025-07-18T13:54:18.740263602Z                                           ^
gitea-mirror  | 2025-07-18T13:54:18.740267316Z SQLiteError: table `accounts` already exists
gitea-mirror  | 2025-07-18T13:54:18.740270957Z       errno: 1,
gitea-mirror  | 2025-07-18T13:54:18.740274656Z  byteOffset: 13,
gitea-mirror  | 2025-07-18T13:54:18.740278339Z 
gitea-mirror  | 2025-07-18T13:54:18.740282001Z       at prepare (bun:sqlite:313:37)
gitea-mirror  | 2025-07-18T13:54:18.740285741Z       at prepareQuery (/app/dist/scripts/migrate-better-auth.js:3795:37)
gitea-mirror  | 2025-07-18T13:54:18.740291165Z       at run (/app/dist/scripts/migrate-better-auth.js:3737:38)
gitea-mirror  | 2025-07-18T13:54:18.740295172Z       at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24)
gitea-mirror  | 2025-07-18T13:54:18.740298850Z       at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21)
gitea-mirror  | 2025-07-18T13:54:18.740302607Z       at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14)
gitea-mirror  | 2025-07-18T13:54:18.740306528Z       at /app/dist/scripts/migrate-better-auth.js:15500:23
gitea-mirror  | 2025-07-18T13:54:18.740310179Z 
gitea-mirror  | 2025-07-18T13:54:18.740849476Z 2149 | }
gitea-mirror  | 2025-07-18T13:54:18.740864310Z 2150 | 
gitea-mirror  | 2025-07-18T13:54:18.740869141Z 2151 | // node_modules/drizzle-orm/errors.js
gitea-mirror  | 2025-07-18T13:54:18.740873212Z 2152 | class DrizzleError extends Error {
gitea-mirror  | 2025-07-18T13:54:18.740907556Z 2153 |   static [entityKind] = "DrizzleError";
gitea-mirror  | 2025-07-18T13:54:18.740913046Z 2154 |     super(message);
gitea-mirror  | 2025-07-18T13:54:18.740916746Z            ^
gitea-mirror  | 2025-07-18T13:54:18.740920307Z DrizzleError: Failed to run the query 'CREATE TABLE `accounts` (
gitea-mirror  | 2025-07-18T13:54:18.740923996Z 	`id` text PRIMARY KEY NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740927764Z 	`account_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740931519Z 	`user_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740935188Z 	`provider_id` text NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740965276Z 	`provider_user_id` text,
gitea-mirror  | 2025-07-18T13:54:18.740977147Z 	`access_token` text,
gitea-mirror  | 2025-07-18T13:54:18.740981120Z 	`refresh_token` text,
gitea-mirror  | 2025-07-18T13:54:18.740984765Z 	`expires_at` integer,
gitea-mirror  | 2025-07-18T13:54:18.740988360Z 	`password` text,
gitea-mirror  | 2025-07-18T13:54:18.740991927Z 	`created_at` integer DEFAULT (unixepoch()) NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740995657Z 	`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
gitea-mirror  | 2025-07-18T13:54:18.740999370Z 	FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
gitea-mirror  | 2025-07-18T13:54:18.741003182Z );
gitea-mirror  | 2025-07-18T13:54:18.741006742Z '
gitea-mirror  | 2025-07-18T13:54:18.741010278Z       at new DrizzleError (/app/dist/scripts/migrate-better-auth.js:2154:5)
gitea-mirror  | 2025-07-18T13:54:18.741013964Z       at run (/app/dist/scripts/migrate-better-auth.js:3739:13)
gitea-mirror  | 2025-07-18T13:54:18.741017637Z       at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24)
gitea-mirror  | 2025-07-18T13:54:18.741021255Z       at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21)
gitea-mirror  | 2025-07-18T13:54:18.741025044Z       at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14)
gitea-mirror  | 2025-07-18T13:54:18.741028826Z       at /app/dist/scripts/migrate-better-auth.js:15500:23
gitea-mirror  | 2025-07-18T13:54:18.741032673Z       at loadAndEvaluateModule (1:11)
gitea-mirror  | 2025-07-18T13:54:18.741036280Z 
gitea-mirror  | 2025-07-18T13:54:18.741039788Z 308 |     if (params.length === 0)
gitea-mirror  | 2025-07-18T13:54:18.741043391Z 309 |       return SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query), createChangesObject();
gitea-mirror  | 2025-07-18T13:54:18.741047183Z 310 |     var arg0 = params[0];
gitea-mirror  | 2025-07-18T13:54:18.741051374Z 311 |     return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0)) ? SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, params) : SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, ...params), createChangesObject();
gitea-mirror  | 2025-07-18T13:54:18.741056018Z 312 |   }
gitea-mirror  | 2025-07-18T13:54:18.741059592Z 313 |     return new Statement(SQL.prepare(this.#handle, query, params, flags || 0, this.#internalFlags));
gitea-mirror  | 2025-07-18T13:54:18.741063363Z                                           ^
gitea-mirror  | 2025-07-18T13:54:18.741067031Z SQLiteError: table `accounts` already exists
gitea-mirror  | 2025-07-18T13:54:18.741075011Z       errno: 1,
gitea-mirror  | 2025-07-18T13:54:18.741079113Z  byteOffset: 13,
gitea-mirror  | 2025-07-18T13:54:18.741082663Z 
gitea-mirror  | 2025-07-18T13:54:18.741086187Z       at prepare (bun:sqlite:313:37)
gitea-mirror  | 2025-07-18T13:54:18.741089918Z       at prepareQuery (/app/dist/scripts/migrate-better-auth.js:3795:37)
gitea-mirror  | 2025-07-18T13:54:18.741093679Z       at run (/app/dist/scripts/migrate-better-auth.js:3737:38)
gitea-mirror  | 2025-07-18T13:54:18.741098359Z       at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24)
gitea-mirror  | 2025-07-18T13:54:18.741102253Z       at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21)
gitea-mirror  | 2025-07-18T13:54:18.741105933Z       at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14)
gitea-mirror  | 2025-07-18T13:54:18.741109674Z       at /app/dist/scripts/migrate-better-auth.js:15500:23
gitea-mirror  | 2025-07-18T13:54:18.741113280Z note: missing sourcemaps for /app/dist/scripts/migrate-better-auth.js
gitea-mirror  | 2025-07-18T13:54:18.741116926Z note: consider bundling with '--sourcemap' to get unminified traces
gitea-mirror  | 2025-07-18T13:54:18.741120611Z 
gitea-mirror  | 2025-07-18T13:54:18.741124184Z Bun v1.2.18 (Linux x64 baseline)

The logs do say that the migration fails due to the db having the accounts table already, but this example above happens even after i manually went into sqlite database and deleted the mentioned table, but it just reappears and causes the issue again.

This is a bit problematic since the :latest docker tag now is pointing to v3, so CI environments will automatically update it and break the application

Downgrading to v2.22.0 brings everything back up, so it's not a corrupted database issue

Originally created by @Cibbi on GitHub (Jul 18, 2025). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/45 Hi! when upgrading to v3, the database migration fails ``` gitea-mirror | 2025-07-18T13:54:18.498027090Z No custom CA certificates found in /app/certs gitea-mirror | 2025-07-18T13:54:18.501236860Z System CA bundle mounted, configuring Node.js to use it... gitea-mirror | 2025-07-18T13:54:18.501270098Z NODE_EXTRA_CA_CERTS set to: /etc/ssl/certs/ca-certificates.crt gitea-mirror | 2025-07-18T13:54:18.501399924Z Using previously generated BETTER_AUTH_SECRET gitea-mirror | 2025-07-18T13:54:18.502118901Z BETTER_AUTH_SECRET has been set to a secure random value gitea-mirror | 2025-07-18T13:54:18.502177088Z Using previously generated ENCRYPTION_SECRET gitea-mirror | 2025-07-18T13:54:18.502894868Z ENCRYPTION_SECRET has been set to a secure random value gitea-mirror | 2025-07-18T13:54:18.503293190Z Database already exists, checking for issues... gitea-mirror | 2025-07-18T13:54:18.601723514Z 🔧 Fixing database location issues... gitea-mirror | 2025-07-18T13:54:18.601773162Z ✅ Database location fixed gitea-mirror | 2025-07-18T13:54:18.605041931Z Running database migrations... gitea-mirror | 2025-07-18T13:54:18.605077395Z Warning: Could not find mirror_jobs table update script. gitea-mirror | 2025-07-18T13:54:18.605083988Z Checking for v3 migrations... gitea-mirror | 2025-07-18T13:54:18.607738079Z 🔄 v3 Migration: Creating Better Auth tables... gitea-mirror | 2025-07-18T13:54:18.621807704Z 🔄 v3 Migration: Migrating users to Better Auth... gitea-mirror | 2025-07-18T13:54:18.733013368Z Successfully connected to SQLite database using Bun's native driver gitea-mirror | 2025-07-18T13:54:18.733351203Z 🔄 Checking for pending migrations... gitea-mirror | 2025-07-18T13:54:18.740074046Z ❌ Error running migrations: 2149 | } gitea-mirror | 2025-07-18T13:54:18.740113575Z 2150 | gitea-mirror | 2025-07-18T13:54:18.740118509Z 2151 | // node_modules/drizzle-orm/errors.js gitea-mirror | 2025-07-18T13:54:18.740122365Z 2152 | class DrizzleError extends Error { gitea-mirror | 2025-07-18T13:54:18.740126309Z 2153 | static [entityKind] = "DrizzleError"; gitea-mirror | 2025-07-18T13:54:18.740130176Z 2154 | super(message); gitea-mirror | 2025-07-18T13:54:18.740133888Z ^ gitea-mirror | 2025-07-18T13:54:18.740137533Z DrizzleError: Failed to run the query 'CREATE TABLE `accounts` ( gitea-mirror | 2025-07-18T13:54:18.740141291Z `id` text PRIMARY KEY NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740145161Z `account_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740148861Z `user_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740152593Z `provider_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740156418Z `provider_user_id` text, gitea-mirror | 2025-07-18T13:54:18.740160130Z `access_token` text, gitea-mirror | 2025-07-18T13:54:18.740164020Z `refresh_token` text, gitea-mirror | 2025-07-18T13:54:18.740167715Z `expires_at` integer, gitea-mirror | 2025-07-18T13:54:18.740171357Z `password` text, gitea-mirror | 2025-07-18T13:54:18.740175313Z `created_at` integer DEFAULT (unixepoch()) NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740179024Z `updated_at` integer DEFAULT (unixepoch()) NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740182706Z FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action gitea-mirror | 2025-07-18T13:54:18.740200898Z ); gitea-mirror | 2025-07-18T13:54:18.740206401Z ' gitea-mirror | 2025-07-18T13:54:18.740210147Z at new DrizzleError (/app/dist/scripts/migrate-better-auth.js:2154:5) gitea-mirror | 2025-07-18T13:54:18.740214089Z at run (/app/dist/scripts/migrate-better-auth.js:3739:13) gitea-mirror | 2025-07-18T13:54:18.740217861Z at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24) gitea-mirror | 2025-07-18T13:54:18.740221630Z at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21) gitea-mirror | 2025-07-18T13:54:18.740225390Z at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14) gitea-mirror | 2025-07-18T13:54:18.740229159Z at /app/dist/scripts/migrate-better-auth.js:15500:23 gitea-mirror | 2025-07-18T13:54:18.740232829Z at loadAndEvaluateModule (1:11) gitea-mirror | 2025-07-18T13:54:18.740236812Z gitea-mirror | 2025-07-18T13:54:18.740240407Z 308 | if (params.length === 0) gitea-mirror | 2025-07-18T13:54:18.740244026Z 309 | return SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query), createChangesObject(); gitea-mirror | 2025-07-18T13:54:18.740247838Z 310 | var arg0 = params[0]; gitea-mirror | 2025-07-18T13:54:18.740251556Z 311 | return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0)) ? SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, params) : SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, ...params), createChangesObject(); gitea-mirror | 2025-07-18T13:54:18.740256116Z 312 | } gitea-mirror | 2025-07-18T13:54:18.740259681Z 313 | return new Statement(SQL.prepare(this.#handle, query, params, flags || 0, this.#internalFlags)); gitea-mirror | 2025-07-18T13:54:18.740263602Z ^ gitea-mirror | 2025-07-18T13:54:18.740267316Z SQLiteError: table `accounts` already exists gitea-mirror | 2025-07-18T13:54:18.740270957Z errno: 1, gitea-mirror | 2025-07-18T13:54:18.740274656Z byteOffset: 13, gitea-mirror | 2025-07-18T13:54:18.740278339Z gitea-mirror | 2025-07-18T13:54:18.740282001Z at prepare (bun:sqlite:313:37) gitea-mirror | 2025-07-18T13:54:18.740285741Z at prepareQuery (/app/dist/scripts/migrate-better-auth.js:3795:37) gitea-mirror | 2025-07-18T13:54:18.740291165Z at run (/app/dist/scripts/migrate-better-auth.js:3737:38) gitea-mirror | 2025-07-18T13:54:18.740295172Z at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24) gitea-mirror | 2025-07-18T13:54:18.740298850Z at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21) gitea-mirror | 2025-07-18T13:54:18.740302607Z at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14) gitea-mirror | 2025-07-18T13:54:18.740306528Z at /app/dist/scripts/migrate-better-auth.js:15500:23 gitea-mirror | 2025-07-18T13:54:18.740310179Z gitea-mirror | 2025-07-18T13:54:18.740849476Z 2149 | } gitea-mirror | 2025-07-18T13:54:18.740864310Z 2150 | gitea-mirror | 2025-07-18T13:54:18.740869141Z 2151 | // node_modules/drizzle-orm/errors.js gitea-mirror | 2025-07-18T13:54:18.740873212Z 2152 | class DrizzleError extends Error { gitea-mirror | 2025-07-18T13:54:18.740907556Z 2153 | static [entityKind] = "DrizzleError"; gitea-mirror | 2025-07-18T13:54:18.740913046Z 2154 | super(message); gitea-mirror | 2025-07-18T13:54:18.740916746Z ^ gitea-mirror | 2025-07-18T13:54:18.740920307Z DrizzleError: Failed to run the query 'CREATE TABLE `accounts` ( gitea-mirror | 2025-07-18T13:54:18.740923996Z `id` text PRIMARY KEY NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740927764Z `account_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740931519Z `user_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740935188Z `provider_id` text NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740965276Z `provider_user_id` text, gitea-mirror | 2025-07-18T13:54:18.740977147Z `access_token` text, gitea-mirror | 2025-07-18T13:54:18.740981120Z `refresh_token` text, gitea-mirror | 2025-07-18T13:54:18.740984765Z `expires_at` integer, gitea-mirror | 2025-07-18T13:54:18.740988360Z `password` text, gitea-mirror | 2025-07-18T13:54:18.740991927Z `created_at` integer DEFAULT (unixepoch()) NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740995657Z `updated_at` integer DEFAULT (unixepoch()) NOT NULL, gitea-mirror | 2025-07-18T13:54:18.740999370Z FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action gitea-mirror | 2025-07-18T13:54:18.741003182Z ); gitea-mirror | 2025-07-18T13:54:18.741006742Z ' gitea-mirror | 2025-07-18T13:54:18.741010278Z at new DrizzleError (/app/dist/scripts/migrate-better-auth.js:2154:5) gitea-mirror | 2025-07-18T13:54:18.741013964Z at run (/app/dist/scripts/migrate-better-auth.js:3739:13) gitea-mirror | 2025-07-18T13:54:18.741017637Z at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24) gitea-mirror | 2025-07-18T13:54:18.741021255Z at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21) gitea-mirror | 2025-07-18T13:54:18.741025044Z at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14) gitea-mirror | 2025-07-18T13:54:18.741028826Z at /app/dist/scripts/migrate-better-auth.js:15500:23 gitea-mirror | 2025-07-18T13:54:18.741032673Z at loadAndEvaluateModule (1:11) gitea-mirror | 2025-07-18T13:54:18.741036280Z gitea-mirror | 2025-07-18T13:54:18.741039788Z 308 | if (params.length === 0) gitea-mirror | 2025-07-18T13:54:18.741043391Z 309 | return SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query), createChangesObject(); gitea-mirror | 2025-07-18T13:54:18.741047183Z 310 | var arg0 = params[0]; gitea-mirror | 2025-07-18T13:54:18.741051374Z 311 | return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0)) ? SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, params) : SQL.run(this.#handle, this.#internalFlags, internalFieldTuple, query, ...params), createChangesObject(); gitea-mirror | 2025-07-18T13:54:18.741056018Z 312 | } gitea-mirror | 2025-07-18T13:54:18.741059592Z 313 | return new Statement(SQL.prepare(this.#handle, query, params, flags || 0, this.#internalFlags)); gitea-mirror | 2025-07-18T13:54:18.741063363Z ^ gitea-mirror | 2025-07-18T13:54:18.741067031Z SQLiteError: table `accounts` already exists gitea-mirror | 2025-07-18T13:54:18.741075011Z errno: 1, gitea-mirror | 2025-07-18T13:54:18.741079113Z byteOffset: 13, gitea-mirror | 2025-07-18T13:54:18.741082663Z gitea-mirror | 2025-07-18T13:54:18.741086187Z at prepare (bun:sqlite:313:37) gitea-mirror | 2025-07-18T13:54:18.741089918Z at prepareQuery (/app/dist/scripts/migrate-better-auth.js:3795:37) gitea-mirror | 2025-07-18T13:54:18.741093679Z at run (/app/dist/scripts/migrate-better-auth.js:3737:38) gitea-mirror | 2025-07-18T13:54:18.741098359Z at migrate (/app/dist/scripts/migrate-better-auth.js:2699:24) gitea-mirror | 2025-07-18T13:54:18.741102253Z at migrate (/app/dist/scripts/migrate-better-auth.js:3972:21) gitea-mirror | 2025-07-18T13:54:18.741105933Z at runDrizzleMigrations (/app/dist/scripts/migrate-better-auth.js:15476:14) gitea-mirror | 2025-07-18T13:54:18.741109674Z at /app/dist/scripts/migrate-better-auth.js:15500:23 gitea-mirror | 2025-07-18T13:54:18.741113280Z note: missing sourcemaps for /app/dist/scripts/migrate-better-auth.js gitea-mirror | 2025-07-18T13:54:18.741116926Z note: consider bundling with '--sourcemap' to get unminified traces gitea-mirror | 2025-07-18T13:54:18.741120611Z gitea-mirror | 2025-07-18T13:54:18.741124184Z Bun v1.2.18 (Linux x64 baseline) ``` The logs do say that the migration fails due to the db having the accounts table already, but this example above happens even after i manually went into sqlite database and deleted the mentioned table, but it just reappears and causes the issue again. This is a bit problematic since the :latest docker tag now is pointing to v3, so CI environments will automatically update it and break the application Downgrading to v2.22.0 brings everything back up, so it's not a corrupted database issue
Author
Owner

@arunavo4 commented on GitHub (Jul 18, 2025):

Hi @Cibbi will try to release a fix today

<!-- gh-comment-id:3089621461 --> @arunavo4 commented on GitHub (Jul 18, 2025): Hi @Cibbi will try to release a fix today
Author
Owner

@arunavo4 commented on GitHub (Jul 18, 2025):

I released v3 yesterday but there were a few issues, still working on fixing and testing them. Will release in a few more hours

<!-- gh-comment-id:3089626000 --> @arunavo4 commented on GitHub (Jul 18, 2025): I released v3 yesterday but there were a few issues, still working on fixing and testing them. Will release in a few more hours
Author
Owner

@arunavo4 commented on GitHub (Jul 18, 2025):

@Cibbi The auto migrate from v2 to v3 got very complicated due to the move to drizzle so this migration now requires a fresh start. Let me know if you face any issues

<!-- gh-comment-id:3090428840 --> @arunavo4 commented on GitHub (Jul 18, 2025): @Cibbi The auto migrate from v2 to v3 got very complicated due to the move to drizzle so this migration now requires a fresh start. Let me know if you face any issues
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#3600