fx 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +58 -0
  3. data/.gitignore +0 -1
  4. data/.rspec +1 -1
  5. data/.standard.yml +3 -0
  6. data/CONTRIBUTING.md +12 -3
  7. data/Gemfile +1 -1
  8. data/README.md +2 -2
  9. data/Rakefile +2 -1
  10. data/bin/setup +0 -4
  11. data/fx.gemspec +20 -22
  12. data/lib/fx/function.rb +4 -4
  13. data/lib/fx/statements/function.rb +3 -5
  14. data/lib/fx/statements/trigger.rb +8 -10
  15. data/lib/fx/version.rb +1 -1
  16. data/lib/fx.rb +3 -3
  17. data/lib/generators/fx/function/function_generator.rb +6 -6
  18. data/lib/generators/fx/trigger/trigger_generator.rb +6 -6
  19. data/spec/acceptance/user_manages_functions_spec.rb +1 -1
  20. data/spec/acceptance/user_manages_triggers_spec.rb +2 -2
  21. data/spec/acceptance_helper.rb +4 -2
  22. data/spec/dummy/Rakefile +4 -4
  23. data/spec/dummy/bin/bundle +2 -2
  24. data/spec/dummy/bin/rails +3 -3
  25. data/spec/dummy/bin/rake +2 -2
  26. data/spec/dummy/config/application.rb +2 -0
  27. data/spec/dummy/config/database.yml +2 -0
  28. data/spec/dummy/config.ru +1 -1
  29. data/spec/features/functions/migrations_spec.rb +1 -1
  30. data/spec/features/functions/revert_spec.rb +4 -4
  31. data/spec/features/triggers/migrations_spec.rb +2 -2
  32. data/spec/features/triggers/revert_spec.rb +8 -8
  33. data/spec/fx/adapters/postgres/triggers_spec.rb +3 -3
  34. data/spec/fx/adapters/postgres_spec.rb +2 -2
  35. data/spec/fx/command_recorder/arguments_spec.rb +4 -4
  36. data/spec/fx/command_recorder_spec.rb +23 -23
  37. data/spec/fx/definition_spec.rb +6 -6
  38. data/spec/fx/function_spec.rb +8 -8
  39. data/spec/fx/schema_dumper/function_spec.rb +14 -16
  40. data/spec/fx/schema_dumper/trigger_spec.rb +3 -3
  41. data/spec/fx/statements/function_spec.rb +17 -17
  42. data/spec/fx/statements/trigger_spec.rb +20 -20
  43. data/spec/fx/trigger_spec.rb +6 -6
  44. data/spec/generators/fx/function/function_generator_spec.rb +3 -3
  45. data/spec/support/definition_helpers.rb +4 -4
  46. data/spec/support/generator_setup.rb +1 -1
  47. data/spec/support/migration_helpers.rb +1 -1
  48. metadata +26 -73
  49. data/.hound.yml +0 -2
  50. data/.rubocop.yml +0 -648
  51. data/.travis.yml +0 -60
  52. data/Appraisals +0 -45
  53. data/bin/appraisal +0 -17
  54. data/gemfiles/rails42.gemfile +0 -10
  55. data/gemfiles/rails50.gemfile +0 -8
  56. data/gemfiles/rails51.gemfile +0 -8
  57. data/gemfiles/rails52.gemfile +0 -8
  58. data/gemfiles/rails60.gemfile +0 -8
  59. data/gemfiles/rails61.gemfile +0 -8
  60. data/gemfiles/rails_edge.gemfile +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f602bcfa44f9289edb4ad43379716b554badc5cdd086d04344d9683564b93ede
4
- data.tar.gz: cfdb703fb8a27cae0622c8f70a38a35a039677b51363d985018b9f638eb8846c
3
+ metadata.gz: bfa4dae8b8e550ee4ddc34b4d0d78c50cc085d01662993f0874f804525fdd51f
4
+ data.tar.gz: 6e57a6df8b97e7638de3b05d9204c4bdcf2db90b585dfb617a1c2e3492d9f8b5
5
5
  SHA512:
6
- metadata.gz: fa2447143558b62d037a7c6515211bfcdae05ca437ced59d949828ef1409f76b79b33dbf71677699b98af53453e5b249de18f76f89c3b9895a6f3705462bb7df
7
- data.tar.gz: 4b5380abef9d337368e80ac0f0f61dd3d70a2514bd560f175f8726a9a089136f4760237b3b3a86a58a01af65d2797a200b1a8a4a1efd58a8a4d58de30af0bb5b
6
+ metadata.gz: c4cf689e5a1847b7ad45b2679dd45046555f750fb7bc8ed9dc2c473da1e6a6eba344a312fa0b33852197ec7c5d81dc92a3ff416939ba8f5435f8a5da16c928df
7
+ data.tar.gz: 1d59049f9bb409bcbb56c3126f9675f1492e0a3d434858d2cb44af8a3d5aba74ee1fe5f78bbc73bab707aae05cfe8d8ed671a4a7e5dc8fa4841df176ebd88c30
@@ -0,0 +1,58 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: master
6
+ pull_request:
7
+ branches: "*"
8
+
9
+ jobs:
10
+ tests:
11
+ name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
18
+ rails: ["6.0", "6.1", "7.0"]
19
+ continue-on-error: [false]
20
+ exclude:
21
+ - ruby: "3.2"
22
+ rails: "6.0"
23
+ - ruby: "3.2"
24
+ rails: "6.1"
25
+
26
+ services:
27
+ postgres:
28
+ image: postgres:14
29
+ env:
30
+ POSTGRES_USER: postgres
31
+ POSTGRES_HOST_AUTH_METHOD: trust
32
+ ports:
33
+ - 5432:5432
34
+ # Set health checks to wait until postgres has started
35
+ options: >-
36
+ --health-cmd pg_isready
37
+ --health-interval 10s
38
+ --health-timeout 5s
39
+ --health-retries 5
40
+
41
+ env:
42
+ POSTGRES_USER: postgres
43
+
44
+ steps:
45
+ - uses: actions/checkout@v3
46
+
47
+ - name: Set up Ruby
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: ${{ matrix.ruby }}
51
+ bundler-cache: true
52
+ rubygems: latest
53
+
54
+ - name: Setup environment
55
+ run: bin/setup
56
+
57
+ - name: Run tests
58
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  /.bundle/
2
- /gemfiles/*.gemfile.lock
3
2
  /.yardoc
4
3
  /Gemfile.lock
5
4
  /_yardoc/
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
1
+ --no-color
2
2
  --require spec_helper
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ ignore:
2
+ - 'spec/dummy/db/schema.rb'
3
+ - '**/tmp/*'
data/CONTRIBUTING.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Contributing
2
2
 
3
+ We love contributions from everyone. By participating in this project, you
4
+ agree to abide by our [code of conduct].
5
+
6
+ [code of conduct]: CODE_OF_CONDUCT.md
7
+
8
+ ## Contributing Code
9
+
3
10
  1. Fork the repository.
4
11
  2. Run `bin/setup`, which will install dependencies and create the dummy
5
12
  application database.
6
- 3. Run `bin/appraisal rake` to verify that the tests pass against all
7
- supported versions of Rails.
8
- 4. Make your change with new passing tests, following the existing style.
13
+ 3. Run `rake` to verify that the tests pass against the version of Rails you are
14
+ running locally.
15
+ 4. Make your change with new passing tests, following existing style.
9
16
  5. Write a [good commit message], push your fork, and submit a pull request.
17
+ 6. CI will run the test suite on all configured versions of Ruby and Rails.
18
+ Address any failures.
10
19
 
11
20
  [good commit message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
12
21
 
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in fx.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # F(x)
2
2
 
3
- [![Build Status](https://travis-ci.com/teoljungberg/fx.svg?token=AgJn4nPeY6ue2Pvy23JQ&branch=master)](https://travis-ci.com/teoljungberg/fx)
3
+ [![Build Status](https://github.com/teoljungberg/fx/actions/workflows/ci.yml/badge.svg)](https://github.com/teoljungberg/fx/actions/workflows/ci.yml)
4
4
  [![Documentation Quality](http://inch-ci.org/github/teoljungberg/fx.svg?branch=master)](http://inch-ci.org/github/teoljungberg/fx)
5
5
 
6
6
  F(x) adds methods to `ActiveRecord::Migration` to create and manage database
@@ -49,7 +49,7 @@ In our example, this might look something like this:
49
49
  CREATE TRIGGER uppercase_users_name
50
50
  BEFORE INSERT ON users
51
51
  FOR EACH ROW
52
- EXECUTE PROCEDURE uppercase_users_name();
52
+ EXECUTE FUNCTION uppercase_users_name();
53
53
  ```
54
54
 
55
55
  The generated migrations contains `create_function` and `create_trigger`
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "standard/rake"
3
4
 
4
5
  namespace :dummy do
5
6
  require_relative "spec/dummy/config/application"
@@ -20,4 +21,4 @@ RSpec::Core::RakeTask.new("spec:acceptance") do |task|
20
21
  end
21
22
 
22
23
  desc "Run the specs and acceptance tests"
23
- task default: %w(spec spec:acceptance)
24
+ task default: %w[spec spec:acceptance standard]
data/bin/setup CHANGED
@@ -5,9 +5,5 @@ set -e
5
5
  gem install bundler --conservative
6
6
  bundle check || bundle install
7
7
 
8
- if [ -z "$CI" ]; then
9
- bundle exec appraisal install
10
- fi
11
-
12
8
  bundle exec rake dummy:db:drop
13
9
  bundle exec rake dummy:db:create
data/fx.gemspec CHANGED
@@ -1,38 +1,36 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "fx/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "fx"
8
- spec.version = Fx::VERSION
9
- spec.authors = ["Teo Ljungberg"]
10
- spec.email = ["teo@teoljungberg.com"]
11
- spec.summary = %q{Support for database functions and triggers in Rails migrations}
12
- spec.description = <<-DESCRIPTION
6
+ spec.name = "fx"
7
+ spec.version = Fx::VERSION
8
+ spec.authors = ["Teo Ljungberg"]
9
+ spec.email = ["teo@teoljungberg.com"]
10
+ spec.summary = "Support for database functions and triggers in Rails migrations"
11
+ spec.description = <<-DESCRIPTION
13
12
  Adds methods to ActiveRecord::Migration to create and manage database functions
14
13
  and triggers in Rails
15
14
  DESCRIPTION
16
- spec.homepage = "https://github.com/teoljungberg/fx"
17
- spec.license = 'MIT'
15
+ spec.homepage = "https://github.com/teoljungberg/fx"
16
+ spec.license = "MIT"
18
17
 
19
- spec.files = `git ls-files -z`.split("\x0")
20
- spec.test_files = spec.files.grep(%r{^spec/})
21
- spec.require_paths = ['lib']
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.require_paths = ["lib"]
22
20
 
23
- spec.add_development_dependency "appraisal", '~> 2.3.0'
24
- spec.add_development_dependency "bundler", '>= 1.5'
21
+ spec.add_development_dependency "ammeter", ">= 1.1.3"
22
+ spec.add_development_dependency "bundler", ">= 1.5"
25
23
  spec.add_development_dependency "database_cleaner"
26
- spec.add_development_dependency "rake"
27
- spec.add_development_dependency "rspec", '>= 3.3'
28
24
  spec.add_development_dependency "pg"
29
25
  spec.add_development_dependency "pry"
30
- spec.add_development_dependency "ammeter", '>= 1.1.3'
31
- spec.add_development_dependency "yard"
26
+ spec.add_development_dependency "rake"
32
27
  spec.add_development_dependency "redcarpet"
28
+ spec.add_development_dependency "rspec", ">= 3.3"
29
+ spec.add_development_dependency "standardrb"
30
+ spec.add_development_dependency "yard"
33
31
 
34
- spec.add_dependency "activerecord", '>= 4.0.0'
35
- spec.add_dependency "railties", '>= 4.0.0'
32
+ spec.add_dependency "activerecord", ">= 6.0.0"
33
+ spec.add_dependency "railties", ">= 6.0.0"
36
34
 
37
- spec.required_ruby_version = ">= 2.1"
35
+ spec.required_ruby_version = ">= 2.7"
38
36
  end
data/lib/fx/function.rb CHANGED
@@ -16,10 +16,10 @@ module Fx
16
16
  end
17
17
 
18
18
  def to_schema
19
- <<-SCHEMA.indent(2)
20
- create_function :#{name}, sql_definition: <<-'SQL'
21
- #{definition.indent(4).rstrip}
22
- SQL
19
+ <<~SCHEMA.indent(2)
20
+ create_function :#{name}, sql_definition: <<-'SQL'
21
+ #{definition.indent(4).rstrip}
22
+ SQL
23
23
  SCHEMA
24
24
  end
25
25
  end
@@ -36,7 +36,7 @@ module Fx
36
36
  if version.nil? && sql_definition.nil?
37
37
  raise(
38
38
  ArgumentError,
39
- "version or sql_definition must be specified",
39
+ "version or sql_definition must be specified"
40
40
  )
41
41
  end
42
42
  sql_definition = sql_definition.strip_heredoc if sql_definition
@@ -57,7 +57,6 @@ module Fx
57
57
  # drop_function(:uppercase_users_name, revert_to_version: 2)
58
58
  #
59
59
  def drop_function(name, options = {})
60
- revert_to_version = options[:revert_to_version]
61
60
  Fx.database.drop_function(name)
62
61
  end
63
62
 
@@ -93,19 +92,18 @@ module Fx
93
92
  def update_function(name, options = {})
94
93
  version = options[:version]
95
94
  sql_definition = options[:sql_definition]
96
- revert_to_version = options[:revert_to_version]
97
95
 
98
96
  if version.nil? && sql_definition.nil?
99
97
  raise(
100
98
  ArgumentError,
101
- "version or sql_definition must be specified",
99
+ "version or sql_definition must be specified"
102
100
  )
103
101
  end
104
102
 
105
103
  sql_definition = sql_definition.strip_heredoc if sql_definition
106
104
  sql_definition ||= Fx::Definition.new(
107
105
  name: name,
108
- version: version,
106
+ version: version
109
107
  ).to_sql
110
108
 
111
109
  Fx.database.update_function(name, sql_definition)
@@ -24,7 +24,7 @@ module Fx
24
24
  # CREATE TRIGGER uppercase_users_name
25
25
  # BEFORE INSERT ON users
26
26
  # FOR EACH ROW
27
- # EXECUTE PROCEDURE uppercase_users_name();
27
+ # EXECUTE FUNCTION uppercase_users_name();
28
28
  # SQL
29
29
  #
30
30
  def create_trigger(name, options = {})
@@ -35,7 +35,7 @@ module Fx
35
35
  if version.present? && sql_definition.present?
36
36
  raise(
37
37
  ArgumentError,
38
- "sql_definition and version cannot both be set",
38
+ "sql_definition and version cannot both be set"
39
39
  )
40
40
  end
41
41
 
@@ -47,7 +47,7 @@ module Fx
47
47
  sql_definition ||= Fx::Definition.new(
48
48
  name: name,
49
49
  version: version,
50
- type: DEFINITION_TYPE,
50
+ type: DEFINITION_TYPE
51
51
  ).to_sql
52
52
 
53
53
  Fx.database.create_trigger(sql_definition)
@@ -68,7 +68,6 @@ module Fx
68
68
  #
69
69
  def drop_trigger(name, options = {})
70
70
  on = options.fetch(:on)
71
- revert_to_version = options[:revert_to_version]
72
71
  Fx.database.drop_trigger(name, on: on)
73
72
  end
74
73
 
@@ -101,26 +100,25 @@ module Fx
101
100
  # CREATE TRIGGER uppercase_users_name
102
101
  # BEFORE INSERT ON users
103
102
  # FOR EACH ROW
104
- # EXECUTE PROCEDURE uppercase_users_name();
103
+ # EXECUTE FUNCTION uppercase_users_name();
105
104
  # SQL
106
105
  #
107
106
  def update_trigger(name, options = {})
108
107
  version = options[:version]
109
108
  on = options[:on]
110
109
  sql_definition = options[:sql_definition]
111
- revert_to_version = options[:revert_to_version]
112
110
 
113
111
  if version.nil? && sql_definition.nil?
114
112
  raise(
115
113
  ArgumentError,
116
- "version or sql_definition must be specified",
114
+ "version or sql_definition must be specified"
117
115
  )
118
116
  end
119
117
 
120
118
  if version.present? && sql_definition.present?
121
119
  raise(
122
120
  ArgumentError,
123
- "sql_definition and version cannot both be set",
121
+ "sql_definition and version cannot both be set"
124
122
  )
125
123
  end
126
124
 
@@ -132,13 +130,13 @@ module Fx
132
130
  sql_definition ||= Fx::Definition.new(
133
131
  name: name,
134
132
  version: version,
135
- type: DEFINITION_TYPE,
133
+ type: DEFINITION_TYPE
136
134
  ).to_sql
137
135
 
138
136
  Fx.database.update_trigger(
139
137
  name,
140
138
  on: on,
141
- sql_definition: sql_definition,
139
+ sql_definition: sql_definition
142
140
  )
143
141
  end
144
142
  end
data/lib/fx/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Fx
2
2
  # @api private
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.0"
4
4
  end
data/lib/fx.rb CHANGED
@@ -19,17 +19,17 @@ module Fx
19
19
  def self.load
20
20
  ActiveRecord::Migration::CommandRecorder.send(
21
21
  :include,
22
- Fx::CommandRecorder,
22
+ Fx::CommandRecorder
23
23
  )
24
24
 
25
25
  ActiveRecord::SchemaDumper.send(
26
26
  :prepend,
27
- Fx::SchemaDumper,
27
+ Fx::SchemaDumper
28
28
  )
29
29
 
30
30
  ActiveRecord::ConnectionAdapters::AbstractAdapter.send(
31
31
  :include,
32
- Fx::Statements,
32
+ Fx::Statements
33
33
  )
34
34
  end
35
35
 
@@ -29,12 +29,12 @@ module Fx
29
29
  if updating_existing_function?
30
30
  migration_template(
31
31
  "db/migrate/update_function.erb",
32
- "db/migrate/update_function_#{file_name}_to_version_#{version}.rb",
32
+ "db/migrate/update_function_#{file_name}_to_version_#{version}.rb"
33
33
  )
34
34
  else
35
35
  migration_template(
36
36
  "db/migrate/create_function.erb",
37
- "db/migrate/create_function_#{file_name}.rb",
37
+ "db/migrate/create_function_#{file_name}.rb"
38
38
  )
39
39
  end
40
40
  end
@@ -45,9 +45,9 @@ module Fx
45
45
 
46
46
  no_tasks do
47
47
  def previous_version
48
- @_previous_version ||= Dir.entries(function_definition_path).
49
- map { |name| version_regex.match(name).try(:[], "version").to_i }.
50
- max
48
+ @_previous_version ||= Dir.entries(function_definition_path)
49
+ .map { |name| version_regex.match(name).try(:[], "version").to_i }
50
+ .max
51
51
  end
52
52
 
53
53
  def version
@@ -82,7 +82,7 @@ module Fx
82
82
  private
83
83
 
84
84
  def function_definition_path
85
- @_function_definition_path ||= Rails.root.join(*%w(db functions))
85
+ @_function_definition_path ||= Rails.root.join(*%w[db functions])
86
86
  end
87
87
 
88
88
  def version_regex
@@ -42,9 +42,9 @@ module Fx
42
42
 
43
43
  no_tasks do
44
44
  def previous_version
45
- @_previous_version ||= Dir.entries(trigger_definition_path).
46
- map { |name| version_regex.match(name).try(:[], "version").to_i }.
47
- max
45
+ @_previous_version ||= Dir.entries(trigger_definition_path)
46
+ .map { |name| version_regex.match(name).try(:[], "version").to_i }
47
+ .max
48
48
  end
49
49
 
50
50
  def version
@@ -81,7 +81,7 @@ module Fx
81
81
  if name.nil?
82
82
  raise(
83
83
  ArgumentError,
84
- "Either `table_name:NAME` or `on:NAME` must be specified",
84
+ "Either `table_name:NAME` or `on:NAME` must be specified"
85
85
  )
86
86
  end
87
87
 
@@ -107,12 +107,12 @@ module Fx
107
107
  Fx::Definition.new(
108
108
  name: file_name,
109
109
  version: version,
110
- type: "trigger",
110
+ type: "trigger"
111
111
  )
112
112
  end
113
113
 
114
114
  def trigger_definition_path
115
- @_trigger_definition_path ||= Rails.root.join(*["db", "triggers"])
115
+ @_trigger_definition_path ||= Rails.root.join("db", "triggers")
116
116
  end
117
117
 
118
118
  # Skip creating migration file if:
@@ -19,7 +19,7 @@ describe "User manages functions" do
19
19
  successfully "rails generate fx:function test"
20
20
  verify_identical_definitions(
21
21
  "db/functions/test_v01.sql",
22
- "db/functions/test_v02.sql",
22
+ "db/functions/test_v02.sql"
23
23
  )
24
24
  write_function_definition "test_v02", <<-EOS
25
25
  CREATE OR REPLACE FUNCTION test()
@@ -18,7 +18,7 @@ describe "User manages triggers" do
18
18
  CREATE TRIGGER uppercase_users_name
19
19
  BEFORE INSERT ON users
20
20
  FOR EACH ROW
21
- EXECUTE PROCEDURE uppercase_users_name();
21
+ EXECUTE FUNCTION uppercase_users_name();
22
22
  EOS
23
23
  successfully "rake db:migrate"
24
24
 
@@ -36,7 +36,7 @@ describe "User manages triggers" do
36
36
  CREATE TRIGGER uppercase_users_name
37
37
  BEFORE UPDATE ON users
38
38
  FOR EACH ROW
39
- EXECUTE PROCEDURE uppercase_users_name();
39
+ EXECUTE FUNCTION uppercase_users_name();
40
40
  EOS
41
41
  successfully "rake db:migrate"
42
42
  execute <<-EOS
@@ -12,7 +12,9 @@ RSpec.configure do |config|
12
12
  config.before(:suite) do
13
13
  Dir.chdir("spec/dummy") do
14
14
  system <<-CMD
15
- git init 1>/dev/null &&
15
+ git init -b master 1>/dev/null &&
16
+ git config user.email "fx@example.com"
17
+ git config user.name "Fx"
16
18
  git add -A &&
17
19
  git commit --no-gpg-sign --message 'initial' 1>/dev/null
18
20
  CMD
@@ -24,7 +26,7 @@ RSpec.configure do |config|
24
26
  ActiveRecord::Base.connection.disconnect!
25
27
  system <<-CMD
26
28
  echo &&
27
- rake db:environment:set db:drop db:create &&
29
+ rake db:environment:set db:drop db:create 1>/dev/null &&
28
30
  git add -A &&
29
31
  git reset --hard HEAD 1>/dev/null &&
30
32
  rm -rf .git/ 1>/dev/null
data/spec/dummy/Rakefile CHANGED
@@ -1,13 +1,13 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require File.expand_path("../config/application", __FILE__)
5
5
 
6
6
  Rails.application.load_tasks
7
7
 
8
- unless Rake::Task.task_defined?('db:environment:set')
9
- desc 'dummy task for rails versions where this task does not exist'
10
- task 'db:environment:set' do
8
+ unless Rake::Task.task_defined?("db:environment:set")
9
+ desc "dummy task for rails versions where this task does not exist"
10
+ task "db:environment:set" do
11
11
  # no-op
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
2
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
3
+ load Gem.bin_path("bundler", "bundle")
data/spec/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
2
+ APP_PATH = File.expand_path("../../config/application", __FILE__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/spec/dummy/bin/rake CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
2
+ require_relative "../config/boot"
3
+ require "rake"
4
4
  Rake.application.run
@@ -11,5 +11,7 @@ module Dummy
11
11
  config.cache_classes = true
12
12
  config.eager_load = false
13
13
  config.active_support.deprecation = :stderr
14
+
15
+ config.active_record.legacy_connection_handling = false
14
16
  end
15
17
  end
@@ -1,5 +1,7 @@
1
1
  development: &default
2
2
  adapter: postgresql
3
+ host: 127.0.0.1
4
+ user: <%= ENV['POSTGRES_USER'] %>
3
5
  database: dummy_development
4
6
  encoding: unicode
5
7
  pool: 5
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path("../config/environment", __FILE__)
4
4
  run Rails.application
@@ -51,7 +51,7 @@ describe "Function migrations", :db do
51
51
  with_function_definition(
52
52
  name: :test,
53
53
  version: 2,
54
- sql_definition: sql_definition,
54
+ sql_definition: sql_definition
55
55
  ) do
56
56
  migration = Class.new(migration_class) do
57
57
  def change
@@ -40,10 +40,10 @@ describe "Reverting migrations", :db do
40
40
  end
41
41
 
42
42
  expect { run_migration(good_migration, [:up, :down]) }.not_to raise_error
43
- expect { run_migration(bad_migration, [:up, :down]) }.
44
- to raise_error(
43
+ expect { run_migration(bad_migration, [:up, :down]) }
44
+ .to raise_error(
45
45
  ActiveRecord::IrreversibleMigration,
46
- /`create_function` is reversible only if given a `revert_to_version`/,
46
+ /`create_function` is reversible only if given a `revert_to_version`/
47
47
  )
48
48
  end
49
49
 
@@ -61,7 +61,7 @@ describe "Reverting migrations", :db do
61
61
  with_function_definition(
62
62
  name: :test,
63
63
  version: 2,
64
- sql_definition: sql_definition,
64
+ sql_definition: sql_definition
65
65
  ) do
66
66
  migration = Class.new(migration_class) do
67
67
  def change
@@ -22,11 +22,11 @@ describe "Trigger migrations", :db do
22
22
  CREATE TRIGGER uppercase_users_name
23
23
  BEFORE INSERT ON users
24
24
  FOR EACH ROW
25
- EXECUTE PROCEDURE uppercase_users_name();
25
+ EXECUTE FUNCTION uppercase_users_name();
26
26
  EOS
27
27
  with_trigger_definition(
28
28
  name: :uppercase_users_name,
29
- sql_definition: sql_definition,
29
+ sql_definition: sql_definition
30
30
  ) do
31
31
  example.run
32
32
  end