Skip to content

Commit

Permalink
Merge branch 'rails-sqlserver:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lavika authored Sep 25, 2023
2 parents 7793e06 + 702d212 commit 09d9210
Show file tree
Hide file tree
Showing 168 changed files with 6,388 additions and 3,340 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
23 changes: 23 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Issue
<!-- Give a brief summary of the issue. -->

## Expected behavior
<!-- Tell us what should happen -->

## Actual behavior
<!-- Tell us what happens instead -->

## How to reproduce
<!-- See https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/How-to-report-a-bug -->

## Details

- **Rails version**: `x.x.x`
- **SQL Server adapter version**: `x.x.x`
- **TinyTDS version**: `x.x.x`
- **FreeTDS details**:

```
run `tsql -C` and paste here the output.
```

30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: Run test suite
runs-on: ubuntu-latest

env:
COMPOSE_FILE: docker-compose.ci.yml

strategy:
fail-fast: false
matrix:
ruby:
- 2.7.8
- 3.0.6
- 3.1.4
- 3.2.2

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build docker images
run: docker-compose build --build-arg TARGET_VERSION=${{ matrix.ruby }}

- name: Run tests
run: docker-compose run ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ debug.log
.DS_Store
pkg/
doc/
db/
*.gem
.bundle
Gemfile.lock
Expand Down
29 changes: 29 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
AllCops:
TargetRubyVersion: 2.5

Layout/LineLength:
Max: 120

Naming/AccessorMethodName:
Enabled: false

Naming/FileName:
Exclude:
- lib/activerecord-sqlserver-adapter.rb

Naming/MethodName:
IgnoredPatterns:
- visit_.*
- primary_Key_From_Table
- table_From_Statement
- distinct_One_As_One_Is_So_Not_Fetch
- make_Fetch_Possible_And_Deterministic

Naming/MethodParameterName:
Enabled: false

Naming/PredicateName:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

32 changes: 0 additions & 32 deletions BACKERS.md

This file was deleted.

24 changes: 4 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
## v5.2.0

- #686 sql_for_insert set table name in case when pk is not nil

## v5.2.0.rc2

#### Fixed

- #681 change_column_null should not clear other column attributes. Fixes #582.
- #684 Fix explain with array conditions. Fixes #673.

## v5.2.0.rc1

#### Fixed

- #638 Don't disable referential integrity for the same table twice.
- #646 Make String equality check work for Type::Data values. Fixes #645.
- #671 Fix tinyint columns schema migration. Fixes #670.
## Unreleased

#### Changed

- #642 Added with (nolock) hint to information_schema.views.
#### Fixed

#### Added

Please check [5-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/5-1-stable/CHANGELOG.md) for previous changes.
Please check [7-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/7-0-stable/CHANGELOG.md) for previous changes.
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

14 changes: 14 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG TARGET_VERSION=3.2.1

FROM ghcr.io/rails-sqlserver/activerecord-sqlserver-adapter:${TARGET_VERSION}

ENV WORKDIR /activerecord-sqlserver-adapter

RUN mkdir -p $WORKDIR
WORKDIR $WORKDIR

COPY . $WORKDIR

RUN RAILS_MAIN=1 bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3

CMD ["sh"]
94 changes: 53 additions & 41 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,74 @@
require 'openssl'
source 'https://rubygems.org'
gemspec
# frozen_string_literal: true

gem 'sqlite3', '~> 1.3.6'
gem 'bcrypt'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
source "https://rubygems.org"

if RbConfig::CONFIG["host_os"] =~ /darwin/
gem 'terminal-notifier-guard'
end
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gemspec

if ENV['RAILS_SOURCE']
gemspec path: ENV['RAILS_SOURCE']
gem "bcrypt"
gem "pg", ">= 0.18.0"
gem "sqlite3", "~> 1.4"
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "benchmark-ips"
gem "minitest", ">= 5.15.0", "< 5.16"
gem "msgpack", ">= 1.7.0"

if ENV["RAILS_SOURCE"]
gemspec path: ENV["RAILS_SOURCE"]
elsif ENV["RAILS_MAIN"]
gem "rails", github: "rails/rails", branch: 'main'
else
# Need to get rails source beacause the gem doesn't include tests
version = ENV['RAILS_VERSION'] || begin
require 'net/http'
require 'yaml'
spec = eval(File.read('activerecord-sqlserver-adapter.gemspec'))
ver = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.requirements.first.last.version
major, minor, tiny, pre = ver.split('.')
if !pre
uri = URI.parse "https://rubygems.org/api/v1/versions/activerecord.yaml"
# Need to get rails source because the gem doesn't include tests
version = ENV["RAILS_VERSION"] || begin
require "openssl"
require "net/http"
require "yaml"

spec = eval(File.read("activerecord-sqlserver-adapter.gemspec"))
ver = spec.dependencies.detect { |d| d.name == "activerecord" }.requirement.requirements.first.last.version
major, minor, _tiny, pre = ver.split(".")

if pre
ver
else
uri = URI.parse("https://rubygems.org/api/v1/versions/activerecord.yaml")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
YAML.load(http.request(Net::HTTP::Get.new(uri.request_uri)).body).select do |data|
a, b, c = data['number'].split('.')
!data['prerelease'] && major == a && (minor.nil? || minor == b)
end.first['number']
else
ver
YAML.load(http.request(Net::HTTP::Get.new(uri.request_uri)).body).find do |data|
a, b, = data["number"].split(".")
!data["prerelease"] && major == a && (minor.nil? || minor == b)
end["number"]
end
end
gem 'rails', git: "git://github.com/rails/rails.git", tag: "v#{version}"
end

if ENV['AREL']
gem 'arel', path: ENV['AREL']
gem "rails", github: "rails/rails", tag: "v#{version}"
end

# rubocop:disable Bundler/DuplicatedGem
group :tinytds do
if ENV['TINYTDS_SOURCE']
gem 'tiny_tds', path: ENV['TINYTDS_SOURCE']
elsif ENV['TINYTDS_VERSION']
gem 'tiny_tds', ENV['TINYTDS_VERSION']
if ENV["TINYTDS_SOURCE"]
gem "tiny_tds", path: ENV["TINYTDS_SOURCE"]
elsif ENV["TINYTDS_VERSION"]
gem "tiny_tds", ENV["TINYTDS_VERSION"]
else
gem 'tiny_tds'
gem "tiny_tds"
end
end
# rubocop:enable Bundler/DuplicatedGem

group :development do
gem 'byebug'
gem 'mocha'
gem 'minitest-spec-rails'
gem "minitest-spec-rails"
gem "mocha"
gem "pry-byebug", platform: [:mri, :mingw, :x64_mingw]
end

group :guard do
gem 'guard'
gem 'guard-minitest'
gem "guard"
gem "guard-minitest"
gem "terminal-notifier-guard" if RbConfig::CONFIG["host_os"] =~ /darwin/
end

group :rubocop do
gem "rubocop", require: false
end
17 changes: 9 additions & 8 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# frozen_string_literal: true

require_relative 'test/support/paths_sqlserver'
require_relative "test/support/paths_sqlserver"

clearing :on
notification :terminal_notifier if defined?(TerminalNotifier)
ignore %r{debug\.log}

ar_lib = File.join ARTest::SQLServer.root_activerecord, 'lib'
ar_test = File.join ARTest::SQLServer.root_activerecord, 'test'
ar_lib = File.join ARTest::SQLServer.root_activerecord, "lib"
ar_test = File.join ARTest::SQLServer.root_activerecord, "test"

guard :minitest, {
all_on_start: false,
autorun: false,
include: ['lib', 'test', ar_lib, ar_test],
test_folders: ['test'],
include: ["lib", "test", ar_lib, ar_test],
test_folders: ["test"],
test_file_patterns: ["*_test.rb", "*_test_sqlserver.rb"]
} do
# Our project watchers.
if ENV['TEST_FILES']
ENV['TEST_FILES'].split(',').map(&:strip).each do |file|
if ENV["TEST_FILES"]
ENV["TEST_FILES"].split(",").map(&:strip).each do |file|
watch(%r{.*}) { file }
end
else
watch(%r{^test/cases/\w+_test_sqlserver\.rb$})
watch(%r{^test/cases/coerced_tests\.rb$}) { "test/cases/coerced_tests.rb" }
watch(%r{^lib/active_record/connection_adapters/sqlserver/([^/]+)\.rb$}) { |m| "test/cases/#{m[1]}_test_sqlserver.rb" }
watch(%r{^test/cases/helper_sqlserver\.rb$}) { 'test' }
watch(%r{^test/cases/helper_sqlserver\.rb$}) { "test" }
end
end
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008-2015
Copyright (c) Ken Collins

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading

0 comments on commit 09d9210

Please sign in to comment.