activerecord_worm_table 0.2.0 → 0.3.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.
- data/VERSION +1 -1
- data/lib/activerecord_worm_table.rb +9 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -71,7 +71,7 @@ module ActiveRecord
|
|
71
71
|
connection.execute(new_ct)
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
74
|
+
def ensure_version_table(name)
|
75
75
|
if !connection.table_exists?(name) # don't execute ddl unless necessary
|
76
76
|
dup_table_schema(base_table_name, name)
|
77
77
|
end
|
@@ -126,6 +126,13 @@ module ActiveRecord
|
|
126
126
|
tvn[ (tvn.index(atn) + 1) % tvn.size ]
|
127
127
|
end
|
128
128
|
|
129
|
+
def ensure_all_tables
|
130
|
+
suffixed_table_names.each do |table_name|
|
131
|
+
ensure_version_table(table_name)
|
132
|
+
end
|
133
|
+
ensure_switch_table
|
134
|
+
end
|
135
|
+
|
129
136
|
# make working table active, then recreate new working table from base table schema
|
130
137
|
def advance_version
|
131
138
|
st = ensure_switch_table
|
@@ -141,7 +148,7 @@ module ActiveRecord
|
|
141
148
|
# ensure the presence of the new active and working tables.
|
142
149
|
# happens after the switch table update, since this may commit a surrounding
|
143
150
|
# transaction in dbs with retarded non-transactional ddl like, oh i dunno, MyFuckingSQL
|
144
|
-
|
151
|
+
ensure_version_table(active_table_name)
|
145
152
|
|
146
153
|
# recreate the new working table from the base schema.
|
147
154
|
new_wtn = working_table_name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_worm_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mccraig mccraig of the clan mccraig
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-05 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|