【问题标题】:ActiveRecord::ConnectionAdapters::SQLite3Adapter does not support skipping duplicatesActiveRecord::ConnectionAdapters::SQLite3Adapter 不支持跳过重复项
【发布时间】:2021-02-07 00:44:12
【问题描述】:

我在尝试在 Github 操作上运行 rspec 时遇到了这个问题。这是我的 github 操作流程。

name: Ruby

on:
  push:
    branches: [ master]
  pull_request:
    branches: [ master]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
      - name: Setup System
        run: |
          sudo apt-get install sqlite3 libsqlite3-dev
      - name: Set up Ruby 2.7.2
        uses: actions/setup-ruby@v1
        with:
          ruby-version: 2.7.2
      - name: Cache Ruby Gems
        uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Bundle Install
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3 --without=production
      - name: Setup DB
        env:
          RAILS_ENV: test
          DISABLE_SPRING: 1
        run: |
          bin/rails db:setup db:migrate db:seed
      - name: Run rspec
        env:
          RAILS_ENV: test
          DISABLE_SPRING: 1
        run: bundle exec rspec

【问题讨论】:

    标签: ruby-on-rails sqlite activerecord


    【解决方案1】:

    tl;dr - 我使用的是旧版本的 SQLite3

    好的,跟踪rail的代码,我发现它调用的sqlite3适配器

    https://github.com/rails/rails/blob/da418dc2508eb8af94ba88b70034021cd17b1abd/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L152

    哪个调用

    https://github.com/rails/rails/blob/da418dc2508eb8af94ba88b70034021cd17b1abd/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L149

    它指定 sqlite3 必须是 3.24.0 或更高版本。

    同时,Github 的 ubuntu-latest 当前(02-2021)使用 Ubuntu 18 作为“最新”。

    Ubuntu 上的 sqlite3 包默认安装 sqlite 3.22。来源:https://packages.ubuntu.com/search?keywords=sqlite3

    所以改成runs-on: ubuntu-20.04之后就没有这个问题了!

    【讨论】:

      猜你喜欢
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-23
      • 1970-01-01
      • 2019-05-14
      • 2020-08-12
      相关资源
      最近更新 更多