安装特定版本的sqlite3

时间:2019-11-21 09:00:43

标签: ruby-on-rails sqlite homebrew

我有一个问题,我的CI版本规格不合格,但它们在本地通过。我在两者上都使用了相同版本的红宝石,并且在两者上都安装了相同的sqlite3 gem。

我能找到的唯一区别是CI服务器似乎使用sqlite3版本:

3.7.17

我的Mac已安装sqlite3版本:3.25.1

失败的规范失败,并显示SQL语法错误:

ActiveRecord::StatementInvalid:  SQLite3::SQLException: near "WITH": syntax error: ;WITH included_items

我想在本地进行测试-看看是否由于Sqlite版本引起。我想以某种方式将本地Mac版本的sqlite3降级为与CI服务器相同的版本。

我尝试使用brew,但似乎找不到任何其他版本的公式。

$ brew install sqlite3@3.7.17
Error: No available formula with the name "sqlite3@3.7.17" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

任何想法如何做到这一点?

1 个答案:

答案 0 :(得分:0)

从Formula / sqlite3.rb的提交日志中:

commit a9ad65c5f2fdc03aa47e4333fcd0df558136b099
Author: Jack Nagel <jacknagel@gmail.com>
Date:   Mon May 20 20:25:17 2013 -0500

    sqlite 3.7.17

所以基本思想是运行:

$ COMMIT=a9ad65c5f2fdc03aa47e4333fcd0df558136b099
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/$COMMIT/Formula/sqlite3.rb

有关更多详细信息,请参见以下要点: https://gist.github.com/demosten/bdbc4f07c2ddbea0b8f0ad50a98ae5ff