culturecode_stagehand 0.12.2 → 0.12.3

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: '091f0329dd66eeb808a7a8efc8ee5741adf0b784'
4
- data.tar.gz: 1f1fb675ec96bde1b1eba99dee37e32589bf3833
3
+ metadata.gz: b2d05bb005a0607370260a87e1943bc565f2bf19
4
+ data.tar.gz: 6724a7c3bc2c2e1b440e0d8f6504e12d8cd3dd5a
5
5
  SHA512:
6
- metadata.gz: f887b8666704eea9831568b093dfbcdbe7a53662f735b97fd07370563e9885ddcddf46d2a7aa070930a628e032ead9b9c2f65256723773875421a24927f129af
7
- data.tar.gz: b0697843d0c5f03a3400e34114aa55448ed36c8e19f9a7ede070e2b9aa0d072ea353574703a2eb4be422fcdc761980f14de1c2a1fbb0a25061d8e8a63b331269
6
+ metadata.gz: 1a6fa1517b1c2e9838c2caabf3055015edfecc2e7d43a62f35353cab02818ce92db86c45697578b7280dfaa38a570eaffcfdff38e26aec22211a1ffa2497a20e
7
+ data.tar.gz: 131bd96034aa7a1e6ec62edfd32a0d45ccc7b4a567b75bbdf1d5d97ce4af76bd32bf8d5c7b127a4ff998b2f5f678260b837a7528e5dcab2a309aecdb776a9757
@@ -15,11 +15,21 @@ module Stagehand
15
15
  end
16
16
 
17
17
  def rename_table(old_table_name, new_table_name, *)
18
+ return super unless Schema.has_stagehand?(old_table_name)
19
+
18
20
  Schema.remove_stagehand!(:only => old_table_name)
19
21
  super
20
22
  Schema.add_stagehand!(:only => new_table_name)
21
23
  Staging::CommitEntry.where(:table_name => old_table_name).update_all(:table_name => new_table_name)
22
24
  end
25
+
26
+ def drop_table(table_name)
27
+ return super unless Schema.has_stagehand?(table_name) && table_exists?(Staging::CommitEntry.table_name)
28
+
29
+ super
30
+ Staging::CommitEntry.where(:table_name => table_name).delete_all
31
+ Staging::Commit.empty.each(&:destroy)
32
+ end
23
33
  end
24
34
 
25
35
  # Allow dumping of stagehand create_table directive
@@ -2,7 +2,11 @@ module Stagehand
2
2
  module Staging
3
3
  class Commit
4
4
  def self.all
5
- CommitEntry.start_operations.pluck(:id).collect {|id| find(id) }
5
+ CommitEntry.end_operations.pluck(:commit_id).collect {|id| find(id) }
6
+ end
7
+
8
+ def self.empty
9
+ all.select(&:empty?)
6
10
  end
7
11
 
8
12
  def self.capture(subject_record = nil, except: [], &block)
@@ -109,6 +113,14 @@ module Stagehand
109
113
  def subject
110
114
  entries.sort_by(&:id).first.record
111
115
  end
116
+
117
+ def empty?
118
+ entries.content_operations.empty?
119
+ end
120
+
121
+ def destroy
122
+ entries.delete_all
123
+ end
112
124
  end
113
125
  end
114
126
 
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.12.2"
2
+ VERSION = "0.12.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: culturecode_stagehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Jakobsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-24 00:00:00.000000000 Z
12
+ date: 2017-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails