gitlab update error
前言
同事为了尝试gitlab的新功能,在我不在场的情况下按照官方文档,独自升级了gitlab,按理说正常升级是不会有问题的,但偏偏就出问题了……问题出在rake db:migrate
正文
升级步骤参见官方文档,本文只针对升级中可能出现的问题做解决方案
问题
在执行到rake db:migrate 时会报错,大概意思是说在Gemfile中没有找到mysql2,具体如下
#sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production rake aborted! Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded.Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
解决方案
报错的同时给出了操作建议,将`gem 'mysql2'`增加到Gemfile文件中。
在Gemfile中查找mysql2的时候发现已经存在此条目,并且gem install mysql2 也是可以安装的,有说需要rails 的版本大于4.0。
这里需要注意,Gemfile 文件已经将需要的依赖包以及版本都写好了,直接使用bundle install就可以,所以应该是不存在版本问题。这里注意到 gem "mysql2", '~> 0.3.16', group: :mysql 有group 声明,有没有可能是因为group声明的问题,于是将, group: :mysql 注释,在执行果然可以了。
#sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
问题
不过到这里可能又出新的问题,命令更新数据库的过程中,可能更新到一半就更新不下去了,报类似如下的错误
rake db:migrate== 20140705105820 CreateStructure: migrating ==================================
-- create_table("users")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:PG::DuplicateTable: ERROR: relation "users" already existsrake db:migrate== 20150616125848 AddFieldsToMovies: migrating ================================-- add_column(:movies, :description, :description)-> 0.0006s-- add_column(:movies, :release_date, :datetime)-> 0.0003s== 20150616125848 AddFieldsToMovies: migrated (0.0009s) =======================
解决方案
这里面有一个问题,有说rake db:migrate不能多次执行,我没有研究过ruby 可能存在这种情况,但这里出现的原因可能并不是因为rake db:migrate 被执行了多次。
这里需要注意的是,升级gitlab到一个新版本的时候,当前的gitlab也必须处于当前最新版本,如当前gitlab 版本为8.5.1 而8.5.x 这个最新版本为8.5.13 ,这就需要先将gitlab 从8.5.1 升级到 8.5.13 ,然后才能将gitlab 从8.5.x 版本升级到8.6.x的版本,否则就有可能出现上面的问题。
总结
gitlab 升级的过程中好像不能跨版本升级,同时升级的时候要保证gitlab处于当前版本的最新小版本状态。
在更新完数据库后,可以通过以下命令查看更新状态
#sudo -u git -H bundle exec rake db:migrate:status RAILS_ENV=production
显示为up 状态的表明已经更新,如果为down 则表明未更新
database: gitlabhq_productionStatus Migration ID Migration Name
--------------------------------------------------up 20121220064453 Init schemaup 20130102143055 Rename owner to creator for projectup 20130110172407 Add public to projectup 20130123114545 Add issues tracker to projectup 20130125090214 Add user permissionsup 20130131070232 Remove private flag from projectup 20130206084024 Add description to namsespaceup 20130207104426 Add description to teamsdown 20130211085435 Add issues tracker id to project
对ruby 不熟,对rake db:migrate 具体的解释请参见
http://stackoverflow.com/questions/10301794/difference-between-rake-dbmigrate-dbreset-and-dbschemaload/10302357#10302357
转载于:https://blog.51cto.com/morrowind/1791817
gitlab update error相关推荐
- [Vue warn]: Duplicate keys detected: ‘0‘. This may cause an update error.
[Vue warn]: Duplicate keys detected: '0'. This may cause an update error. 刚开始看到这个问题我还有点奇怪,因为只在for循环哪 ...
- Duplicate keys detected: '0'. This may cause an update error.
运行vue项目的时候,出现了[Vue warn]: Duplicate keys detected: '0'. This may cause an update error(错误,检测到重复的key值 ...
- vue学习中遇到的错误 Duplicate keys detected: ‘[object Object]‘. This may cause an update error.
前端入门自学,说错的请大神指点. Avoid using non-primitive value as key, use string/number value instead. Duplicate ...
- Duplicate keys detected: ‘checks‘. This may cause an update error. found in
Duplicate keys detected: 'checks'. This may cause an update error. 1.怎么查看报错 2.分析报错的原因 3.怎么修改这样的报错 4. ...
- Duplicate keys detected: ‘gggggg‘. This may cause an update error.的解决办法
vue项目中报了一个这样的错:Duplicate keys detected: 'gggggg'. This may cause an update error. 虽然不影响使用吧,但是一直冒红也不太 ...
- gitlab ci ERROR: Uploading artifacts to coordinator... too large archive
gitlab ci ERROR: Uploading artifacts to coordinator... too large archive gitlab ci 提交编译文件太大,导致413错误 ...
- TortoiseSVN更新失败解决(update error)文件更新同步更新到SVN
一.TortoiseSVN更新失败解决(update error) 报错原因:更新svn时没有关闭在svn上打开的文件. 1.进入svn所在父级文件夹(你自己所创建的放svn文件的下一级) 2.SVN ...
- Vue中报“Duplicate keys detected: ‘xxx‘. This may cause an update error.”的解决办法
在Vue中遇到"Duplicate keys detected: 'xxx'. This may cause an update error."这样的错误提示,最有用的解决办法,亲 ...
- (已解决)Win10下MikTeX update error报错:code=56, url=http://ftp.yzu.edu.tw/CTAN/systems/win32/miktex/...
win10系统下 MikTeX update error 按照官网(https://miktex.org/howto/install-miktex) 安装好 MikTeX 后,按照官网教程运行MikT ...
- Mysql -update - Error Code: 1175. You are using safe update mode and you tried to update a table wit
使用MySQL执行update的时候报错:Error Code: 1175. You are using safe update mode and you tried to update a tabl ...
最新文章
- upgrade yum 指定版本_yum upgrade和yum update的区别
- php变量定义的位置,php变量一般放在哪个位置
- mysql 存过 if_mysql中 储存过程 if exists 该如何写呀
- java或异运算_JAVA 或与非运算符 与()、或(|)、异或(^)【组图】
- softmax函数上溢出和下溢出(转载+自己理解)
- 微机总线地址,物理地址 ,虚拟地址
- react之路:使用immutable管理store中的数据
- R爬虫小白入门:Rvest爬链家网+分析(一)
- Linux下sdio设备扫描过程,[mmc]Linux下MMC/SD/SDIO的识别与操作
- java64位1.8.0下载_jdk1.8下载 64位
- 清华大学计算机科学与技术专业设置,清华大学计算机科学与技术专业介绍
- 侮辱性极强!6年编发无数反诈骗新闻,90后小编竟被骗了5万...
- unity 插件uniwebview 内嵌H5游戏
- 计算机445 135 139端口,关闭445 135 137 138 139端口方法图文教程
- 如何将Windbg设置为异常捕获默认程序?
- adb 切换usb模式_adb调试命令,adb强制打开usb调试,adb命令打开usb调试
- android设置左右声道音量,android控制左右声道实例
- 基于Azure Kinect SDK获取物体rgb图、深度图、红外IR图和点云数据并保存到本地
- 华东师范大学 硕士毕业论文模版 overleaf版
- Shader学习之Cg语言二(Cg数据类型)