acts_as_archive 0.1.4 → 0.1.5
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/Rakefile +1 -1
- data/acts_as_archive.gemspec +2 -2
- data/lib/acts_as_archive/base/table.rb +8 -2
- data/spec/acts_as_archive/base/table_spec.rb +11 -5
- data/spec/db/config/database.yml +9 -6
- metadata +2 -2
data/Rakefile
CHANGED
data/acts_as_archive.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{acts_as_archive}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Winton Welsh"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-11-24}
|
10
10
|
s.default_executable = %q{acts_as_archive}
|
11
11
|
s.email = %q{mail@wintoni.us}
|
12
12
|
s.executables = ["acts_as_archive"]
|
@@ -19,9 +19,9 @@ module ActsAsArchive
|
|
19
19
|
if table_exists? && !archive_table_exists?
|
20
20
|
connection.execute(%{
|
21
21
|
CREATE TABLE archived_#{table_name}
|
22
|
-
ENGINE=InnoDB
|
22
|
+
#{"ENGINE=InnoDB" unless sqlite?}
|
23
23
|
AS SELECT * from #{table_name}
|
24
|
-
WHERE
|
24
|
+
WHERE 1 = 0;
|
25
25
|
})
|
26
26
|
columns = connection.columns("archived_#{table_name}").collect(&:name)
|
27
27
|
unless columns.include?('deleted_at')
|
@@ -56,6 +56,12 @@ module ActsAsArchive
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def sqlite?
|
63
|
+
ActiveRecord::Base.connection.class.to_s.downcase.include?('sqlite')
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
module InstanceMethods
|
@@ -32,17 +32,23 @@ describe ActsAsArchive::Base::Table do
|
|
32
32
|
describe 'create_archive_indexes' do
|
33
33
|
|
34
34
|
before(:all) do
|
35
|
-
Article.
|
35
|
+
unless Article.send(:sqlite?)
|
36
|
+
Article.create_archive_indexes
|
37
|
+
end
|
36
38
|
end
|
37
39
|
|
38
40
|
it "should create archive indexes" do
|
39
|
-
|
41
|
+
unless Article.send(:sqlite?)
|
42
|
+
indexes.should == [ "id", "deleted_at" ]
|
43
|
+
end
|
40
44
|
end
|
41
45
|
|
42
46
|
it "should destroy archive indexes" do
|
43
|
-
Article.
|
44
|
-
|
45
|
-
|
47
|
+
unless Article.send(:sqlite?)
|
48
|
+
Article.class_eval { acts_as_archive }
|
49
|
+
Article.create_archive_indexes
|
50
|
+
indexes.should == []
|
51
|
+
end
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
data/spec/db/config/database.yml
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
test:
|
2
|
-
adapter:
|
3
|
-
database:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
adapter: sqlite3
|
3
|
+
database: ":memory:"
|
4
|
+
# test:
|
5
|
+
# adapter: mysql
|
6
|
+
# database: acts_as_archive
|
7
|
+
# username: root
|
8
|
+
# password:
|
9
|
+
# host: localhost
|
10
|
+
# socket: /tmp/mysql.sock
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-24 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|