deleted_at 0.6.0.pre.3 → 0.6.0.pre.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/README.md +4 -3
- data/lib/deleted_at.rb +5 -0
- data/lib/deleted_at/railtie.rb +0 -5
- data/lib/deleted_at/version.rb +1 -1
- metadata +65 -30
- data/lib/deleted_at/table.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b961f6d68ebc577038934dd5e5d8d32d639f7f4667aa096adf303a6d1fc86905
|
4
|
+
data.tar.gz: 65f42ba3a95cf9a133ed58112be04f0b6641843513f2274755b032011c907835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6447c0e00a54df35bf8e1716d51e827a0cbd72f0a858add054f5521d10840d415cb3a3c3695fba7d2925da75153487986a9cab838c79e7fdae2aa3c3026f79d2
|
7
|
+
data.tar.gz: fb1f91ddb742532af5bdada96db9efc395bc97092909defcd7976275660a522470e16b7c76f1a5ce64bb8cbe39d727e47ea69156fc123de6e6bfd089aefd4077
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
# DeletedAt
|
2
2
|
|
3
|
+
## 0.6.0 _(May 25, 2019)_
|
4
|
+
- Major overhaul of functionality, extracted to [`ActiveRecord::Framing`](https://github.com/TwilightCoders/active_record-framing) and refined into gem
|
5
|
+
- Consumes `ActiveRecord::Framing`
|
6
|
+
- Simplified gem and distilled to only domain specific functionality
|
7
|
+
- Adds official support for ActiveSupport up to 5.2
|
8
|
+
- Adds official support for Ruby 2.6
|
9
|
+
- Unbound upper constraint for ActiveSupport
|
10
|
+
- 100% test coverage
|
11
|
+
|
3
12
|
## 0.5.0 _(June 25, 2018)_
|
4
13
|
- Removed use of invasive views in preference of sub-selects
|
5
14
|
- Dropped support for Ruby 2.0, 2.1, 2.2
|
6
|
-
- Dropped support for
|
15
|
+
- Dropped support for ActiveSupport 4.1
|
7
16
|
- Default `deleted_at` options using `Proc`
|
8
17
|
|
9
18
|
## 0.4.0 _(Never Released)_
|
10
|
-
- Specs for
|
19
|
+
- Specs for ActiveSupport 4.0-5.1
|
11
20
|
- Uses `combustion` gem for cleaner and more comprehensive testing
|
12
21
|
- Added badges to ReadMe
|
13
22
|
- Using `:prepend` to leverage ancestry chain
|
data/README.md
CHANGED
@@ -12,7 +12,9 @@ Hide your "deleted" data (unless specifically asked for) [without resorting to](
|
|
12
12
|
## Requirements
|
13
13
|
|
14
14
|
- Ruby 2.3+
|
15
|
-
- ActiveRecord 4.
|
15
|
+
- ActiveRecord 4.2+
|
16
|
+
|
17
|
+
_Note: Be sure to check the builds to be sure your version is in-fact supported. The requirements are left unbounded on the upper constraint for posterity, but may not be gaurenteed to work._
|
16
18
|
|
17
19
|
## Installation
|
18
20
|
|
@@ -102,10 +104,9 @@ class IndexDeletedAtColumns < ActiveRecord::Migration
|
|
102
104
|
end
|
103
105
|
```
|
104
106
|
|
105
|
-
|
106
107
|
## [Upgrading](#upgrading)
|
107
108
|
|
108
|
-
If you've used `deleted_at` prior to v0.5.0, you'll need to migrate your schema. The new version of `deleted_at` no longer uses views, instead constructing a
|
109
|
+
If you've used `deleted_at` prior to v0.5.0, you'll need to migrate your schema. The new version of `deleted_at` no longer uses views, instead constructing a common table expression (CTE) on the relations. This significantly reduces code polution and monkey patching, as well as reducing the runtime memory usage for rails. Your Database will look (and be) a lot cleaner with no `deleted_at` views (and your ERDs will be much cleaner as well).
|
109
110
|
|
110
111
|
Here is an example of a migration for upgrading
|
111
112
|
```ruby
|
data/lib/deleted_at.rb
CHANGED
data/lib/deleted_at/railtie.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
require 'rails/railtie'
|
2
|
-
require 'active_record/framing'
|
3
|
-
require 'deleted_at/relation'
|
4
|
-
require 'deleted_at/core'
|
5
|
-
require 'deleted_at/table_definition'
|
6
2
|
|
7
3
|
module DeletedAt
|
8
4
|
class Railtie < Rails::Railtie
|
@@ -10,7 +6,6 @@ module DeletedAt
|
|
10
6
|
ActiveSupport.on_load(:active_record) do
|
11
7
|
::ActiveRecord::Base.prepend(DeletedAt::Core)
|
12
8
|
::ActiveRecord::ConnectionAdapters::TableDefinition.prepend(DeletedAt::TableDefinition)
|
13
|
-
# ::ActiveRecord::Associations::Association.prepend(DeletedAt::Association)
|
14
9
|
end
|
15
10
|
end
|
16
11
|
end
|
data/lib/deleted_at/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deleted_at
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0.pre.
|
4
|
+
version: 0.6.0.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Stevens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,53 +24,78 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '4.2'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: active_record-framing
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "
|
31
|
+
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.1.0.pre.
|
33
|
+
version: 0.1.0.pre.7
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- - "
|
38
|
+
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.1.0.pre.
|
40
|
+
version: 0.1.0.pre.7
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: pg
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- - "
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- - "
|
52
|
+
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
56
|
+
name: bundler
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- - "
|
59
|
+
- - ">="
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
61
|
+
version: '0'
|
68
62
|
type: :development
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
|
-
- - "
|
66
|
+
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
68
|
+
version: '0'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: combustion
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-byebug
|
77
99
|
requirement: !ruby/object:Gem::Requirement
|
78
100
|
requirements:
|
79
101
|
- - ">="
|
@@ -90,30 +112,44 @@ dependencies:
|
|
90
112
|
name: rake
|
91
113
|
requirement: !ruby/object:Gem::Requirement
|
92
114
|
requirements:
|
93
|
-
- - "
|
115
|
+
- - ">="
|
94
116
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
117
|
+
version: '0'
|
96
118
|
type: :development
|
97
119
|
prerelease: false
|
98
120
|
version_requirements: !ruby/object:Gem::Requirement
|
99
121
|
requirements:
|
100
|
-
- - "
|
122
|
+
- - ">="
|
101
123
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
124
|
+
version: '0'
|
103
125
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
126
|
+
name: database_cleaner
|
105
127
|
requirement: !ruby/object:Gem::Requirement
|
106
128
|
requirements:
|
107
|
-
- - "
|
129
|
+
- - ">="
|
108
130
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0
|
131
|
+
version: '0'
|
110
132
|
type: :development
|
111
133
|
prerelease: false
|
112
134
|
version_requirements: !ruby/object:Gem::Requirement
|
113
135
|
requirements:
|
114
|
-
- - "
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
115
144
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
117
153
|
description: Default scopes are bad. Don't delete your data.
|
118
154
|
email:
|
119
155
|
- dale@twilightcoders.net
|
@@ -130,7 +166,6 @@ files:
|
|
130
166
|
- lib/deleted_at/legacy.rb
|
131
167
|
- lib/deleted_at/railtie.rb
|
132
168
|
- lib/deleted_at/relation.rb
|
133
|
-
- lib/deleted_at/table.rb
|
134
169
|
- lib/deleted_at/table_definition.rb
|
135
170
|
- lib/deleted_at/version.rb
|
136
171
|
homepage: https://github.com/TwilightCoders/deleted_at
|
data/lib/deleted_at/table.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module DeletedAt
|
2
|
-
class Table < Arel::Table
|
3
|
-
|
4
|
-
attr_accessor :shadow
|
5
|
-
|
6
|
-
def initialize(table_name, engine, shadow:)
|
7
|
-
super(table_name).tap do |table|
|
8
|
-
@engine = engine
|
9
|
-
@shadow = shadow
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def name
|
14
|
-
case Thread.current[:selecting_deleted_at]
|
15
|
-
when nil, false
|
16
|
-
super
|
17
|
-
else
|
18
|
-
super + shadow.to_s
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|