sequel-rails 1.1.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba61c0752e0e4ebeea5a6c4b01f6cf85f94c0413866c43dad74af0cfa694950a
4
- data.tar.gz: 30ea0b29dd1ffbe0438f1b2ed1626a176146348aa4c820de51b85335eec8d4f0
3
+ metadata.gz: 8ae909ba1a811f03330fa4fa5f66433fb725e48f878da92a62a3f3a0d31cfa75
4
+ data.tar.gz: 2701e9e4c9d8389dbac1888edbc64db469ebddbd966f30af08c16317ebd2c0f0
5
5
  SHA512:
6
- metadata.gz: 1455a020956c332f8d91d65fd11678ca3701ca404cfd32adc760e1f753ab531c5e29433d3a1189d12a07c76a779feea1935913e7cc65ef518b85caf210a01dc6
7
- data.tar.gz: d8be6934a488b6a4aff2eb6ca6b6007833fc9614439809a8a20a691c398dbd79768f3eb62711ad50c41e427e3ecd41f4845ca546590389f0a2860a2ba41a76e4
6
+ metadata.gz: d26336d4cf8376c3a08b6fcdf6fbbdecd4976cef3747f845bb1c022f7f3429140beb981ba2ae86ffed9754b0a063979386a0c765cf116f2aa4b8b587b14433bb
7
+ data.tar.gz: c14f662a88af0d045327c13bf94bd16946865c65cb73539d328934b45fb7a7de6ef0ae92616a442fff99619d61d6380e9df1fdeef0fb1a742c4edbf5726d7d59
@@ -26,6 +26,7 @@ gemfile:
26
26
  - ci/rails-5.0.gemfile
27
27
  - ci/rails-5.1.gemfile
28
28
  - ci/rails-5.2.gemfile
29
+ - ci/rails-6.0.gemfile
29
30
  matrix:
30
31
  exclude:
31
32
  - rvm: 2.4.9
@@ -50,6 +51,13 @@ matrix:
50
51
  gemfile: ci/rails-4.0.gemfile
51
52
  - rvm: jruby-9.2.8.0
52
53
  gemfile: ci/rails-4.1.gemfile
54
+ - rvm: 2.2.9
55
+ gemfile: ci/rails-6.0.gemfile
56
+ - rvm: 2.3.8
57
+ gemfile: ci/rails-6.0.gemfile
58
+ - rvm: 2.4.9
59
+ gemfile: ci/rails-6.0.gemfile
60
+
53
61
  notifications:
54
62
  email:
55
63
  - jonathan.tron@metrilio.com
data/History.md CHANGED
@@ -1,3 +1,14 @@
1
+ master (unreleased)
2
+ ===================
3
+
4
+ * Fix readme formatting (Ben Koshy)
5
+ [#175](https://github.com/TalentBox/sequel-rails/pull/175)
6
+ * Add frozen_string_literal to migration template (Semyon Pupkov)
7
+ [#174](https://github.com/TalentBox/sequel-rails/pull/174)
8
+ * Add allow_missing_migration_files option (Semyon Pupkov)
9
+ [#172](https://github.com/TalentBox/sequel-rails/pull/172)
10
+ [#173](https://github.com/TalentBox/sequel-rails/pull/173)
11
+
1
12
  1.1.0 (2019-10-29)
2
13
  ==================
3
14
 
data/README.md CHANGED
@@ -166,6 +166,9 @@ You can configure some options with the usual rails mechanism, in
166
166
  # Allowed options: :sql, :ruby.
167
167
  config.sequel.schema_format = :sql
168
168
 
169
+ # Allowed options: true, false, default false
170
+ config.sequel.allow_missing_migration_files = true
171
+
169
172
  # Whether to dump the schema after successful migrations.
170
173
  # Defaults to false in production and test, true otherwise.
171
174
  config.sequel.schema_dump = true
@@ -250,11 +253,11 @@ Here's some examples:
250
253
 
251
254
  For in memory testing:
252
255
 
253
- ```yaml
254
- development:
256
+ ```yaml
257
+ development:
255
258
  adapter: sqlite # Also accept sqlite3
256
259
  database: ":memory:"
257
- ```
260
+ ```
258
261
 
259
262
  Enabling plugins
260
263
  ================
@@ -412,6 +415,8 @@ Improvements have been made by those awesome contributors:
412
415
  * Dustin Byrne (@dsbyrne)
413
416
  * Michael Coyne (@mjc-gh)
414
417
  * p-leger (@p-leger)
418
+ * Semyon Pupkov (@artofhuman)
419
+ * Ben Koshy (@BKSpurgeon)
415
420
 
416
421
  Credits
417
422
  =======
@@ -0,0 +1,28 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'railties', '~> 6.0.0'
4
+ gem 'activemodel', '~> 6.0.0'
5
+ gem 'actionpack', '~> 6.0.0'
6
+
7
+ gemspec :path => '../'
8
+
9
+ gem 'sequel', "#{ENV['SEQUEL']}"
10
+
11
+ gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
12
+
13
+ # MRI/Rubinius Adapter Dependencies
14
+ platform :ruby do
15
+ gem 'pg'
16
+ if RUBY_VERSION < '2.4'
17
+ gem 'mysql'
18
+ end
19
+ gem 'mysql2'
20
+ gem 'sqlite3'
21
+ end
22
+
23
+ # JRuby Adapter Dependencies
24
+ platform :jruby do
25
+ gem 'jdbc-sqlite3'
26
+ gem 'jdbc-mysql'
27
+ gem 'jdbc-postgres'
28
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Sequel.migration do
2
4
  <%- if use_change -%>
3
5
  change do
@@ -6,6 +6,7 @@ module SequelRails
6
6
  def migrate(version = nil)
7
7
  opts = {}
8
8
  opts[:target] = version.to_i if version
9
+ opts[:allow_missing_migration_files] = !!SequelRails.configuration.allow_missing_migration_files
9
10
 
10
11
  if migrations_dir.directory?
11
12
  ::Sequel::Migrator.run(::Sequel::Model.db, migrations_dir, opts)
@@ -29,8 +30,7 @@ module SequelRails
29
30
  res = ''
30
31
 
31
32
  if available_migrations?
32
- migrator_class = ::Sequel::Migrator.send(:migrator_class, migrations_dir)
33
- migrator = migrator_class.new db, migrations_dir
33
+ migrator = init_migrator
34
34
  res << adapter.schema_information_dump(migrator, sql)
35
35
  end
36
36
  res
@@ -43,8 +43,8 @@ module SequelRails
43
43
  def current_migration
44
44
  return unless available_migrations?
45
45
 
46
- migrator_class = ::Sequel::Migrator.send(:migrator_class, migrations_dir)
47
- migrator = migrator_class.new ::Sequel::Model.db, migrations_dir
46
+ migrator = init_migrator
47
+
48
48
  if migrator.respond_to?(:applied_migrations)
49
49
  migrator.applied_migrations.last
50
50
  elsif migrator.respond_to?(:current_version)
@@ -55,8 +55,8 @@ module SequelRails
55
55
  def previous_migration
56
56
  return unless available_migrations?
57
57
 
58
- migrator_class = ::Sequel::Migrator.send(:migrator_class, migrations_dir)
59
- migrator = migrator_class.new ::Sequel::Model.db, migrations_dir
58
+ migrator = init_migrator
59
+
60
60
  if migrator.respond_to?(:applied_migrations)
61
61
  migrator.applied_migrations[-2] || '0'
62
62
  elsif migrator.respond_to?(:current_version)
@@ -67,6 +67,16 @@ module SequelRails
67
67
  def available_migrations?
68
68
  File.exist?(migrations_dir) && Dir[File.join(migrations_dir, '*')].any?
69
69
  end
70
+
71
+ def init_migrator
72
+ migrator_class = ::Sequel::Migrator.send(:migrator_class, migrations_dir)
73
+
74
+ migrator_class.new(
75
+ ::Sequel::Model.db,
76
+ migrations_dir,
77
+ allow_missing_migration_files: !!SequelRails.configuration.allow_missing_migration_files
78
+ )
79
+ end
70
80
  end
71
81
  end
72
82
  end
@@ -13,6 +13,7 @@ module SequelRails
13
13
  commands = ['mysqldump']
14
14
  add_connection_settings commands
15
15
  add_flag commands, '--no-data'
16
+ add_flag commands, '--skip-dump-date'
16
17
  add_option commands, '--result-file', filename
17
18
  commands << database
18
19
  safe_exec commands
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
@@ -8,23 +8,40 @@ describe SequelRails::Migrations do
8
8
  describe ".#{migration_method}" do
9
9
  let(:result) { double(:result) }
10
10
  context 'with no version specified' do
11
- let(:opts) { {} }
12
11
  it 'runs migrations using Sequel::Migrator' do
13
12
  expect(::Sequel::Migrator).to receive(:run).with(
14
- db, Rails.root.join('db/migrate'), opts
13
+ db, Rails.root.join('db/migrate'), allow_missing_migration_files: false
15
14
  ).and_return result
16
15
  expect(described_class.send(migration_method)).to be(result)
17
16
  end
18
17
  end
19
18
  context 'with version specified' do
20
- let(:opts) { { :target => 1 } }
21
19
  it 'runs migrations using Sequel::Migrator' do
22
20
  expect(::Sequel::Migrator).to receive(:run).with(
23
- db, Rails.root.join('db/migrate'), opts
21
+ db, Rails.root.join('db/migrate'), allow_missing_migration_files: false, target: 1
24
22
  ).and_return result
25
23
  expect(described_class.send(migration_method, 1)).to be(result)
26
24
  end
27
25
  end
26
+
27
+ context 'with allow_missing_migration_files' do
28
+ around do |ex|
29
+ option = SequelRails.configuration.allow_missing_migration_files
30
+ SequelRails.configuration.allow_missing_migration_files = true
31
+
32
+ ex.run
33
+
34
+ SequelRails.configuration.allow_missing_migration_files = option
35
+ end
36
+
37
+ it 'runs migrations using Sequel::Migrator' do
38
+ expect(::Sequel::Migrator).to receive(:run).with(
39
+ db, Rails.root.join('db/migrate'), allow_missing_migration_files: true
40
+ ).and_return result
41
+
42
+ described_class.send(migration_method)
43
+ end
44
+ end
28
45
  end
29
46
  end
30
47
 
@@ -46,7 +46,7 @@ describe SequelRails::Storage::Mysql, :mysql do
46
46
  let(:dump_file_name) { 'dump.sql' }
47
47
  it 'uses the mysqldump command' do
48
48
  expect(subject).to receive(:`).with(
49
- "mysqldump --user\\=#{username} --password\\=#{password} --host\\=#{host} --port\\=#{port} --no-data --result-file\\=#{dump_file_name} #{database}"
49
+ "mysqldump --user\\=#{username} --password\\=#{password} --host\\=#{host} --port\\=#{port} --no-data --skip-dump-date --result-file\\=#{dump_file_name} #{database}"
50
50
  )
51
51
  subject._dump dump_file_name
52
52
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brasten Sager (brasten)
8
8
  - Jonathan TRON
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-29 00:00:00.000000000 Z
12
+ date: 2020-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -216,6 +216,7 @@ files:
216
216
  - ci/rails-5.0.gemfile
217
217
  - ci/rails-5.1.gemfile
218
218
  - ci/rails-5.2.gemfile
219
+ - ci/rails-6.0.gemfile
219
220
  - config.ru
220
221
  - lib/action_dispatch/middleware/session/sequel_store.rb
221
222
  - lib/generators/sequel.rb
@@ -283,7 +284,7 @@ homepage: http://talentbox.github.io/sequel-rails/
283
284
  licenses:
284
285
  - MIT
285
286
  metadata: {}
286
- post_install_message:
287
+ post_install_message:
287
288
  rdoc_options:
288
289
  - "--charset=UTF-8"
289
290
  require_paths:
@@ -299,8 +300,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
300
  - !ruby/object:Gem::Version
300
301
  version: 1.8.11
301
302
  requirements: []
302
- rubygems_version: 3.0.3
303
- signing_key:
303
+ rubygems_version: 3.1.2
304
+ signing_key:
304
305
  specification_version: 4
305
306
  summary: Use Sequel with Rails (3.x and 4.x)
306
307
  test_files: