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 +4 -4
- data/lib/iron_trail/config.rb +10 -1
- data/lib/iron_trail/migration.rb +3 -0
- data/lib/iron_trail/version.rb +1 -1
- data/lib/iron_trail.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4541270b52cf87af024251d4b442fca74f17bf54c913b12baa2f61267d6aef7f
|
|
4
|
+
data.tar.gz: c151fa8780fb9ef8aeb6e8ee0870b315cb2a97a776086ea1653776ef12b7f124
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f81445c9ffac1c12426e5313d62587ec6cd91609fef8658ac23d156e6298453aedf6d43282a999d80eda8807139b35fc7e73491a7b62893a974a9df06950de0
|
|
7
|
+
data.tar.gz: 32be78582d5146fb289b4b0a297d64d2d6c912528405d2a16f0111649cd686e39098bce51f9fea335d590d0c96d1cd1b703c552f6e898e504f5a4727976119ce
|
data/lib/iron_trail/config.rb
CHANGED
|
@@ -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
|
data/lib/iron_trail/migration.rb
CHANGED
|
@@ -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)
|
data/lib/iron_trail/version.rb
CHANGED
data/lib/iron_trail.rb
CHANGED
|
@@ -30,7 +30,9 @@ module IronTrail
|
|
|
30
30
|
|
|
31
31
|
module SchemaDumper
|
|
32
32
|
def trailer(stream)
|
|
33
|
-
|
|
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
|