dynamodb_framework 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43c68b4046339dcf1497fd9b227b2b28856c281e
|
4
|
+
data.tar.gz: cd4cccc048de83ac5b7d3f793cedf90be72ad18c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18566e0f81953f9f6956e813a15340cb15e8d937247773a91a0895e7106e2022587cf629d8b0d5ae13cd7b48e41bccf98aa90fde3f74972ac56666e11267ff1d
|
7
|
+
data.tar.gz: 7ee89bb2e01f23de3ff65f3c6a157db3a3f1d5faf3384c92a22613c3bd2b5a20594fc08747ab6493a305948a1c976d632a4824786114efc488340011b54f333d
|
@@ -32,8 +32,8 @@ module DynamoDbFramework
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
-
def get_executed_scripts
|
36
|
-
scripts = @dynamodb_repository.
|
35
|
+
def get_executed_scripts(namespace)
|
36
|
+
scripts = @dynamodb_repository.query(:namespace, namespace)
|
37
37
|
if scripts.length > 0
|
38
38
|
return scripts.sort { |a,b| b['timestamp'] <=> a['timestamp'] }.map { |i| i['timestamp'] }
|
39
39
|
end
|
@@ -41,11 +41,11 @@ module DynamoDbFramework
|
|
41
41
|
return nil
|
42
42
|
end
|
43
43
|
|
44
|
-
def apply
|
44
|
+
def apply(namespace)
|
45
45
|
|
46
46
|
DynamoDbFramework.logger.info "[#{self.class}] - Applying migration scripts"
|
47
47
|
|
48
|
-
executed_scripts = get_executed_scripts()
|
48
|
+
executed_scripts = get_executed_scripts(namespace)
|
49
49
|
|
50
50
|
scripts = []
|
51
51
|
DynamoDbFramework::MigrationScript.descendants.each do |ms|
|
@@ -57,7 +57,7 @@ module DynamoDbFramework
|
|
57
57
|
if executed_scripts == nil || !executed_scripts.include?(script.timestamp)
|
58
58
|
DynamoDbFramework.logger.info "[#{self.class}] - Applying script: #{script.timestamp}....."
|
59
59
|
script.apply
|
60
|
-
@dynamodb_repository.put({ :timestamp => script.timestamp })
|
60
|
+
@dynamodb_repository.put({ :timestamp => script.timestamp, :namespace => script.namespace })
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -65,11 +65,11 @@ module DynamoDbFramework
|
|
65
65
|
|
66
66
|
end
|
67
67
|
|
68
|
-
def rollback
|
68
|
+
def rollback(namespace)
|
69
69
|
|
70
70
|
DynamoDbFramework.logger.info "[#{self.class}] - Rolling back started."
|
71
71
|
|
72
|
-
executed_scripts = get_executed_scripts()
|
72
|
+
executed_scripts = get_executed_scripts(namespace)
|
73
73
|
|
74
74
|
scripts = []
|
75
75
|
DynamoDbFramework::MigrationScript.descendants.each do |ms|
|
@@ -80,7 +80,7 @@ module DynamoDbFramework
|
|
80
80
|
scripts.sort { |a,b| a.timestamp <=> b.timestamp }.each do |script|
|
81
81
|
if executed_scripts != nil && executed_scripts.length > 0 && executed_scripts.include?(script.timestamp)
|
82
82
|
script.undo
|
83
|
-
@dynamodb_repository.delete({ :timestamp => script.timestamp })
|
83
|
+
@dynamodb_repository.delete({ :timestamp => script.timestamp, :namespace => script.namespace })
|
84
84
|
return
|
85
85
|
end
|
86
86
|
end
|