define repository name uniqueness per namespace
This commit is contained in:
@@ -111,15 +111,5 @@ func migrateLegacySQLite(engine *xorm.Engine) error {
|
|||||||
return fmt.Errorf("migrate repo column repo_name to name: %w", err)
|
return fmt.Errorf("migrate repo column repo_name to name: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(columns) > 0 {
|
|
||||||
// Older schemas accidentally made namespace_id unique by itself, limiting
|
|
||||||
// a namespace to one repository. The model key is (namespace_id, name).
|
|
||||||
if _, err := engine.Exec("DROP INDEX IF EXISTS UQE_repo_cred"); err != nil {
|
|
||||||
return fmt.Errorf("drop legacy repo unique index: %w", err)
|
|
||||||
}
|
|
||||||
if _, err := engine.Exec("CREATE UNIQUE INDEX IF NOT EXISTS UQE_repo_cred ON repo (namespace_id, name)"); err != nil {
|
|
||||||
return fmt.Errorf("create repo unique index: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user