iron_trail 0.1.9 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 753981303307f8c0e8ac890d5426bcecc73d961ce45df3149542c2c67a8a2724
4
- data.tar.gz: cf9d8c51d58bda2d5f8390f1fb1a8f7a7b8c3d6992b4ce1fd372e14c6724f120
3
+ metadata.gz: 4541270b52cf87af024251d4b442fca74f17bf54c913b12baa2f61267d6aef7f
4
+ data.tar.gz: c151fa8780fb9ef8aeb6e8ee0870b315cb2a97a776086ea1653776ef12b7f124
5
5
  SHA512:
6
- metadata.gz: 6b8b34cdc76c0890e8f01903a92b1671e03f3cb2cfdadc8ed6b5e1518f3a2b203ac968f29a978c672c79d48332772587d2cfe3f1c01a6c93fa5f12bff2187e43
7
- data.tar.gz: 51133e321739d2e08cdaa76d679d0dd0453f36b79b34614521de83ed8c600f71588864604727690ec69e1b96d8a6ae9cd5579fe425fe032842c1ef4053fca992
6
+ metadata.gz: 2f81445c9ffac1c12426e5313d62587ec6cd91609fef8658ac23d156e6298453aedf6d43282a999d80eda8807139b35fc7e73491a7b62893a974a9df06950de0
7
+ data.tar.gz: 32be78582d5146fb289b4b0a297d64d2d6c912528405d2a16f0111649cd686e39098bce51f9fea335d590d0c96d1cd1b703c552f6e898e504f5a4727976119ce
@@ -15,12 +15,17 @@ module IronTrail
15
15
  :enable,
16
16
  :track_migrations_starting_at_version
17
17
 
18
- attr_reader :ignored_tables
18
+ attr_reader :ignored_tables, :ignored_databases
19
19
 
20
20
  def initialize
21
+ reset!
22
+ end
23
+
24
+ def reset!
21
25
  @enable = true
22
26
  @track_by_default = true
23
27
  @ignored_tables = DEFAULT_IGNORED_TABLES.dup
28
+ @ignored_databases = []
24
29
  @track_migrations_starting_at_version = nil
25
30
  end
26
31
 
@@ -31,5 +36,9 @@ module IronTrail
31
36
  def ignored_tables=(v)
32
37
  raise 'Overwriting ignored_tables is not allow. Instead, add or remove to it explicitly.'
33
38
  end
39
+
40
+ def ignored_databases=(v)
41
+ raise 'Overwriting ignored_databases is not allowed. Instead, add or remove to it explicitly.'
42
+ end
34
43
  end
35
44
  end
@@ -10,6 +10,9 @@ module IronTrail
10
10
 
11
11
  return result unless IronTrail.enabled? && method == :create_table
12
12
 
13
+ db_name = connection.pool.db_config.name
14
+ return result if IronTrail.ignore_database?(db_name)
15
+
13
16
  start_at_version = IronTrail.config.track_migrations_starting_at_version
14
17
  if !running_from_schema && start_at_version
15
18
  return result if self.version < Integer(start_at_version)
@@ -1,5 +1,5 @@
1
1
  # frozen_literal_string: true
2
2
 
3
3
  module IronTrail
4
- VERSION = '0.1.9'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/iron_trail.rb CHANGED
@@ -30,7 +30,9 @@ module IronTrail
30
30
 
31
31
  module SchemaDumper
32
32
  def trailer(stream)
33
- if IronTrail.enabled?
33
+ db_name = @connection.pool.db_config.name
34
+
35
+ if IronTrail.enabled? && !IronTrail.ignore_database?(db_name)
34
36
  stream.print "\n IronTrail.post_schema_load(self, missing_tracking: @irontrail_missing_track)\n"
35
37
  end
36
38
 
@@ -57,6 +59,10 @@ module IronTrail
57
59
  (OWN_TABLES + (config.ignored_tables || [])).include?(name)
58
60
  end
59
61
 
62
+ def ignore_database?(name)
63
+ (config.ignored_databases || []).include?(name.to_s)
64
+ end
65
+
60
66
  def post_schema_load(context, missing_tracking: nil)
61
67
  df = IronTrail::DbFunctions.new(context.connection)
62
68
  df.install_functions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Diego Piske