gitea: Unable to migrate from version 1.7.4 to version 1.8.0

  • Gitea version (or commit ref): 1.8.0
  • Git version: 2.16.2.windows.1
  • Operating system: WIndows server 2012
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [x ] Not relevant
  • Log gist:

Description

Hi guys, I’m facing a issue when upgrading from version 1.74 to 1.8.0 :

2019/04/22 10:25:23 [I] Migration: add theme to users 2019/04/22 10:25:30 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:30 [I] Backing off for 3 seconds 2019/04/22 10:25:33 [I] ORM engine initialization attempt #2/10… 2019/04/22 10:25:33 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:34 [I] Backing off for 3 seconds 2019/04/22 10:25:37 [I] ORM engine initialization attempt #3/10… 2019/04/22 10:25:37 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:37 [I] Backing off for 3 seconds 2019/04/22 10:25:40 [I] ORM engine initialization attempt #4/10… 2019/04/22 10:25:40 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:40 [I] Backing off for 3 seconds 2019/04/22 10:25:44 [I] ORM engine initialization attempt #5/10… 2019/04/22 10:25:44 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:44 [I] Backing off for 3 seconds 2019/04/22 10:25:47 [I] ORM engine initialization attempt #6/10… 2019/04/22 10:25:47 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:47 [I] Backing off for 3 seconds 2019/04/22 10:25:50 [I] ORM engine initialization attempt #7/10… 2019/04/22 10:25:50 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:51 [I] Backing off for 3 seconds 2019/04/22 10:25:54 [I] ORM engine initialization attempt #8/10… 2019/04/22 10:25:54 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:54 [I] Backing off for 3 seconds 2019/04/22 10:25:57 [I] ORM engine initialization attempt #9/10… 2019/04/22 10:25:57 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:25:57 [I] Backing off for 3 seconds 2019/04/22 10:26:00 [I] ORM engine initialization attempt #10/10… 2019/04/22 10:26:00 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:01 […itea/routers/init.go:82 GlobalInit()] [E] ORM engine initialization failed: migrate: do migrate: Drop column failed: mssql: Error de ALTER TABLE DROP COLUMN is_bare debido a que uno o más objetos tienen acceso a columna. 2019/04/22 10:26:22 [I] Log Mode: File(Info) 2019/04/22 10:26:22 [I] XORM Log Mode: File(Info) 2019/04/22 10:26:22 [I] Cache Service Enabled 2019/04/22 10:26:22 [I] Session Service Enabled 2019/04/22 10:26:22 [I] Mail Service Enabled 2019/04/22 10:26:22 [I] Notify Mail Service Enabled 2019/04/22 10:26:22 [I] Beginning ORM engine initialization. 2019/04/22 10:26:22 [I] ORM engine initialization attempt #1/10… 2019/04/22 10:26:22 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:29 [I] Backing off for 3 seconds 2019/04/22 10:26:32 [I] ORM engine initialization attempt #2/10… 2019/04/22 10:26:32 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:33 [I] Backing off for 3 seconds 2019/04/22 10:26:36 [I] ORM engine initialization attempt #3/10… 2019/04/22 10:26:36 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:36 [I] Backing off for 3 seconds 2019/04/22 10:26:39 [I] ORM engine initialization attempt #4/10… 2019/04/22 10:26:39 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:39 [I] Backing off for 3 seconds 2019/04/22 10:26:42 [I] ORM engine initialization attempt #5/10… 2019/04/22 10:26:43 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:43 [I] Backing off for 3 seconds 2019/04/22 10:26:46 [I] ORM engine initialization attempt #6/10… 2019/04/22 10:26:46 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:46 [I] Backing off for 3 seconds 2019/04/22 10:26:49 [I] ORM engine initialization attempt #7/10… 2019/04/22 10:26:49 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:50 [I] Backing off for 3 seconds 2019/04/22 10:26:53 [I] ORM engine initialization attempt #8/10… 2019/04/22 10:26:53 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:54 [I] Backing off for 3 seconds 2019/04/22 10:26:57 [I] ORM engine initialization attempt #9/10… 2019/04/22 10:26:57 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:26:57 [I] Backing off for 3 seconds 2019/04/22 10:27:00 [I] ORM engine initialization attempt #10/10… 2019/04/22 10:27:00 [I] Migration: rename repo is_bare to repo is_empty 2019/04/22 10:27:01 […itea/routers/init.go:82 GlobalInit()] [E] ORM engine initialization failed: migrate: do migrate: Drop column failed: mssql: Error de ALTER TABLE DROP COLUMN is_bare debido a que uno o más objetos tienen acceso a columna.

Do you have any solution or workaround for this?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

This script can be used to drop the constraint without knowing the exact name

DECLARE @ConstraintName VARCHAR(256)
DECLARE @SQL NVARCHAR(256)
SELECT @ConstraintName = obj.name FROM sys.columns col LEFT OUTER JOIN sys.objects obj ON obj.object_id = col.default_object_id AND obj.type = 'D' WHERE col.object_id = OBJECT_ID('repository') AND obj.name IS NOT NULL AND col.name = 'is_bare'
SET @SQL = N'ALTER TABLE [repository] DROP CONSTRAINT [' + @ConstraintName + N']'
EXEC sp_executesql @SQL

Ah that’s why the migration didn’t work for you. OK we’re screwed in those cases and we will just have to cope with the issue reports I guess.

OK, so you need to double check that repositories that are empty are marked with is_empty because unfortunately you’ll get 500s if you try to access them.