multiverse 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: ce5783babc9113d0316026b66a1422a96197a3a6
4
- data.tar.gz: 61c98174e4f294ec7b06153f5317d698c150b574
3
+ metadata.gz: 564a47885d1668334ca29f1c0d036f8cfe03e850
4
+ data.tar.gz: 87575b3d26f533b2a53aebdeaa6138c499b75708
5
5
  SHA512:
6
- metadata.gz: 7fb064da5869d11381bed4badda210c0ea09eedde16a70ce1bae61a44f5f68fd34ecae1144cd6a9a6e5a10e5196b90fa3b5f541da5cbe21f75958579b1e9ad6a
7
- data.tar.gz: b5756f721abc0b70b68c2aef1251ec7bdb6449c0dacee2cf005c891eb2602aa8e975a0e9b892a7b953544d47d4846a1cd2e38f86b5853eb655a7379319cf8836
6
+ metadata.gz: a94499ae8268d11fb6a833e564cfb73b165800a7bf7f4cfdcc095f105ed2543f68125a7f22221b548240dbbe65d89e6bdeb89b6cc224da12124f8bd163827ffa
7
+ data.tar.gz: 1322982a75cd8f8c8e0bb0c0edbdf51361d47a40b7448ca95948021f5adfaf5cae6768a6525eee714bef755d23e04134700314152f17ab8ab6b335167db63d08
@@ -1,7 +1,12 @@
1
+ ## 0.0.3
2
+
3
+ - Removed debug statement
4
+ - Fixed issue with `db:test:prepare`
5
+
1
6
  ## 0.0.2
2
7
 
3
8
  - Better configuration for SQLite
4
- - Fixed issues with `db:schema:load` and `db:test:prepare`
9
+ - Fixed issue with `db:schema:load`
5
10
 
6
11
  ## 0.0.1
7
12
 
data/README.md CHANGED
@@ -6,6 +6,8 @@ One of the easiest ways to scale your database is to move large, infrequently-jo
6
6
 
7
7
  Works with Rails 5+
8
8
 
9
+ [![Build Status](https://travis-ci.org/ankane/multiverse.svg?branch=master)](https://travis-ci.org/ankane/multiverse)
10
+
9
11
  ## Installation
10
12
 
11
13
  Add this line to your application’s Gemfile:
@@ -16,20 +16,26 @@ module Multiverse
16
16
 
17
17
  module Migrator
18
18
  def initialize(*_)
19
- puts "Migrator#initialize"
20
19
  # ActiveRecord::Migration#initialize calls
21
- # ActiveRecord::SchemaMigration.create_table
20
+ # ActiveRecord::SchemaMigration.create_table and
22
21
  # ActiveRecord::InternalMetadata.create_table
23
22
  # which both inherit from ActiveRecord::Base
24
23
  #
25
24
  # We need to change this for migrations
26
- # but not for db:schema:load (messes up multiverse test env otherwise)
25
+ # but not for db:schema:load, as this
26
+ # will mess up the Multiverse test environment
27
27
  ActiveRecord::SchemaMigration.singleton_class.prepend(Multiverse::Connection)
28
28
  ActiveRecord::InternalMetadata.singleton_class.prepend(Multiverse::Connection)
29
29
  super
30
30
  end
31
31
  end
32
32
 
33
+ module Connection
34
+ def connection
35
+ Multiverse.record_class.connection
36
+ end
37
+ end
38
+
33
39
  module Migration
34
40
  # TODO don't checkout main connection at all
35
41
  def exec_migration(_, direction)
@@ -39,12 +45,6 @@ module Multiverse
39
45
  end
40
46
  end
41
47
 
42
- module Connection
43
- def connection
44
- Multiverse.record_class.connection
45
- end
46
- end
47
-
48
48
  module SchemaDumper
49
49
  def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base)
50
50
  new(Multiverse.record_class.connection, generate_options(Multiverse.record_class)).dump(stream)
@@ -18,6 +18,22 @@ module Multiverse
18
18
  end
19
19
 
20
20
  namespace :test do
21
+ task load_schema: %w(db:test:purge) do
22
+ begin
23
+ should_reconnect = ActiveRecord::Base.connection_pool.active_connection?
24
+ ActiveRecord::Schema.verbose = false
25
+ ActiveRecord::Tasks::DatabaseTasks.load_schema ActiveRecord::Base.configurations[Multiverse.env("test")], :ruby, ENV["SCHEMA"]
26
+ ensure
27
+ if should_reconnect
28
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Multiverse.env(ActiveRecord::Tasks::DatabaseTasks.env)])
29
+ end
30
+ end
31
+ end
32
+
33
+ task load_structure: %w(db:test:purge) do
34
+ ActiveRecord::Tasks::DatabaseTasks.load_schema ActiveRecord::Base.configurations[Multiverse.env("test")], :sql, ENV["SCHEMA"]
35
+ end
36
+
21
37
  task purge: %w(environment load_config check_protected_environments) do
22
38
  ActiveRecord::Tasks::DatabaseTasks.purge ActiveRecord::Base.configurations[Multiverse.env("test")]
23
39
  end
@@ -1,3 +1,3 @@
1
1
  module Multiverse
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiverse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails