hoardable 0.14.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.streerc +1 -0
- data/.tool-versions +2 -2
- data/CHANGELOG.md +19 -0
- data/Gemfile +9 -10
- data/README.md +198 -177
- data/Rakefile +22 -8
- data/lib/generators/hoardable/install_generator.rb +25 -26
- data/lib/generators/hoardable/migration_generator.rb +17 -8
- data/lib/generators/hoardable/templates/install.rb.erb +2 -25
- data/lib/generators/hoardable/templates/migration.rb.erb +7 -1
- data/lib/hoardable/arel_visitors.rb +57 -0
- data/lib/hoardable/database_client.rb +41 -23
- data/lib/hoardable/engine.rb +32 -33
- data/lib/hoardable/error.rb +4 -7
- data/lib/hoardable/finder_methods.rb +1 -3
- data/lib/hoardable/has_many.rb +6 -10
- data/lib/hoardable/has_one.rb +3 -3
- data/lib/hoardable/has_rich_text.rb +14 -7
- data/lib/hoardable/model.rb +19 -16
- data/lib/hoardable/schema_dumper.rb +25 -0
- data/lib/hoardable/schema_statements.rb +33 -0
- data/lib/hoardable/scopes.rb +22 -29
- data/lib/hoardable/source_model.rb +6 -5
- data/lib/hoardable/version.rb +1 -1
- data/lib/hoardable/version_model.rb +30 -31
- data/lib/hoardable.rb +21 -18
- data/sig/hoardable.rbs +37 -12
- metadata +14 -29
- data/.rubocop.yml +0 -21
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hoardable
|
4
|
+
module SchemaDumper
|
5
|
+
def ignored?(table_name)
|
6
|
+
super || @connection.inherited_table?(table_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def tables(stream)
|
10
|
+
super
|
11
|
+
dump_inherited_tables(stream)
|
12
|
+
empty_line(stream)
|
13
|
+
triggers(stream)
|
14
|
+
end
|
15
|
+
|
16
|
+
private def dump_inherited_tables(stream)
|
17
|
+
sorted_tables = @connection.tables.filter { |table| @connection.inherited_table?(table) }.sort
|
18
|
+
sorted_tables.each do |table_name|
|
19
|
+
table(table_name, stream)
|
20
|
+
foreign_keys(table_name, stream)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
private_constant :SchemaDumper
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hoardable
|
4
|
+
module SchemaStatements
|
5
|
+
def table_options(table_name)
|
6
|
+
options = super || {}
|
7
|
+
if !options[:options] && (inherited_table_names = parent_table_names(table_name))
|
8
|
+
options[:options] = "INHERITS (#{inherited_table_names.join(", ")})"
|
9
|
+
end
|
10
|
+
options
|
11
|
+
end
|
12
|
+
|
13
|
+
private def parent_table_names(table_name)
|
14
|
+
scope = quoted_scope(table_name, type: "BASE TABLE")
|
15
|
+
|
16
|
+
query_values(<<~SQL.presence, "SCHEMA").presence
|
17
|
+
SELECT parent.relname
|
18
|
+
FROM pg_catalog.pg_inherits i
|
19
|
+
JOIN pg_catalog.pg_class child ON i.inhrelid = child.oid
|
20
|
+
JOIN pg_catalog.pg_class parent ON i.inhparent = parent.oid
|
21
|
+
LEFT JOIN pg_namespace n ON n.oid = child.relnamespace
|
22
|
+
WHERE child.relname = #{scope[:name]}
|
23
|
+
AND child.relkind IN (#{scope[:type]})
|
24
|
+
AND n.nspname = #{scope[:schema]}
|
25
|
+
SQL
|
26
|
+
end
|
27
|
+
|
28
|
+
def inherited_table?(table_name)
|
29
|
+
parent_table_names(table_name).present?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
private_constant :SchemaStatements
|
33
|
+
end
|
data/lib/hoardable/scopes.rb
CHANGED
@@ -6,23 +6,12 @@ module Hoardable
|
|
6
6
|
module Scopes
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
|
-
TABLEOID_AREL_CONDITIONS = lambda do |arel_table, condition|
|
10
|
-
arel_table[:tableoid].send(
|
11
|
-
condition,
|
12
|
-
Arel::Nodes::NamedFunction.new('CAST', [Arel::Nodes::Quoted.new(arel_table.name).as('regclass')])
|
13
|
-
)
|
14
|
-
end.freeze
|
15
|
-
private_constant :TABLEOID_AREL_CONDITIONS
|
16
|
-
|
17
9
|
included do
|
18
|
-
# @!visibility private
|
19
|
-
attr_writer :tableoid
|
20
|
-
|
21
10
|
# By default {Hoardable} only returns instances of the parent table, and not the +versions+ in
|
22
11
|
# the inherited table. This can be bypassed by using the {.include_versions} scope or wrapping
|
23
12
|
# the code in a `Hoardable.at(datetime)` block.
|
24
13
|
default_scope do
|
25
|
-
if (hoardable_at = Hoardable.instance_variable_get(
|
14
|
+
if (hoardable_at = Hoardable.instance_variable_get("@at"))
|
26
15
|
at(hoardable_at)
|
27
16
|
else
|
28
17
|
exclude_versions
|
@@ -35,7 +24,7 @@ module Hoardable
|
|
35
24
|
#
|
36
25
|
# Returns +versions+ along with instances of the source models, all cast as instances of the
|
37
26
|
# source model’s class.
|
38
|
-
scope :include_versions, -> { unscope(
|
27
|
+
scope :include_versions, -> { unscope(:from) }
|
39
28
|
|
40
29
|
# @!scope class
|
41
30
|
# @!method versions
|
@@ -43,7 +32,7 @@ module Hoardable
|
|
43
32
|
#
|
44
33
|
# Returns only +versions+ of the parent +ActiveRecord+ class, cast as instances of the source
|
45
34
|
# model’s class.
|
46
|
-
scope :versions, -> {
|
35
|
+
scope :versions, -> { from("ONLY #{version_class.table_name}") }
|
47
36
|
|
48
37
|
# @!scope class
|
49
38
|
# @!method exclude_versions
|
@@ -51,7 +40,7 @@ module Hoardable
|
|
51
40
|
#
|
52
41
|
# Excludes +versions+ of the parent +ActiveRecord+ class. This is included by default in the
|
53
42
|
# source model’s +default_scope+.
|
54
|
-
scope :exclude_versions, -> {
|
43
|
+
scope :exclude_versions, -> { from("ONLY #{table_name}") }
|
55
44
|
|
56
45
|
# @!scope class
|
57
46
|
# @!method at
|
@@ -59,21 +48,25 @@ module Hoardable
|
|
59
48
|
#
|
60
49
|
# Returns instances of the source model and versions that were valid at the supplied
|
61
50
|
# +datetime+ or +time+, all cast as instances of the source model.
|
62
|
-
scope
|
63
|
-
|
51
|
+
scope(
|
52
|
+
:at,
|
53
|
+
lambda do |datetime|
|
54
|
+
raise(CreatedAtColumnMissingError, table_name) unless column_names.include?("created_at")
|
64
55
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
56
|
+
from(
|
57
|
+
Arel::Nodes::As.new(
|
58
|
+
Arel::Nodes::Union.new(
|
59
|
+
include_versions.where(id: version_class.at(datetime).select(primary_key)).arel,
|
60
|
+
exclude_versions
|
61
|
+
.where(created_at: ..datetime)
|
62
|
+
.where.not(id: version_class.select(:hoardable_id).where(DURING_QUERY, datetime))
|
63
|
+
.arel
|
64
|
+
),
|
65
|
+
arel_table
|
66
|
+
)
|
67
|
+
).hoardable
|
68
|
+
end
|
69
|
+
)
|
77
70
|
end
|
78
71
|
end
|
79
72
|
end
|
@@ -32,11 +32,11 @@ module Hoardable
|
|
32
32
|
include Scopes
|
33
33
|
|
34
34
|
around_update(if: [HOARDABLE_CALLBACKS_ENABLED, HOARDABLE_VERSION_UPDATES]) do |_, block|
|
35
|
-
hoardable_client.insert_hoardable_version(
|
35
|
+
hoardable_client.insert_hoardable_version("update", &block)
|
36
36
|
end
|
37
37
|
|
38
38
|
around_destroy(if: [HOARDABLE_CALLBACKS_ENABLED, HOARDABLE_SAVE_TRASH]) do |_, block|
|
39
|
-
hoardable_client.insert_hoardable_version(
|
39
|
+
hoardable_client.insert_hoardable_version("delete", &block)
|
40
40
|
end
|
41
41
|
|
42
42
|
before_destroy(if: HOARDABLE_CALLBACKS_ENABLED, unless: HOARDABLE_SAVE_TRASH) do
|
@@ -47,7 +47,8 @@ module Hoardable
|
|
47
47
|
|
48
48
|
# Returns all +versions+ in ascending order of their temporal timeframes.
|
49
49
|
has_many(
|
50
|
-
:versions,
|
50
|
+
:versions,
|
51
|
+
-> { order("UPPER(_during) ASC") },
|
51
52
|
dependent: nil,
|
52
53
|
class_name: version_class.to_s,
|
53
54
|
inverse_of: :hoardable_source,
|
@@ -85,7 +86,7 @@ module Hoardable
|
|
85
86
|
#
|
86
87
|
# @param datetime [DateTime, Time]
|
87
88
|
def version_at(datetime)
|
88
|
-
raise(Error,
|
89
|
+
raise(Error, "Future state cannot be known") if datetime.future?
|
89
90
|
|
90
91
|
versions.at(datetime).limit(1).first
|
91
92
|
end
|
@@ -101,7 +102,7 @@ module Hoardable
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def hoardable_id
|
104
|
-
read_attribute(
|
105
|
+
read_attribute("hoardable_id")
|
105
106
|
end
|
106
107
|
|
107
108
|
delegate :version_class, to: :class
|
data/lib/hoardable/version.rb
CHANGED
@@ -13,13 +13,6 @@ module Hoardable
|
|
13
13
|
def version_class
|
14
14
|
self
|
15
15
|
end
|
16
|
-
|
17
|
-
# This is needed to omit the pseudo row of 'tableoid' when using +ActiveRecord+’s +insert+.
|
18
|
-
#
|
19
|
-
# @!visibility private
|
20
|
-
def scope_attributes
|
21
|
-
super.without('tableoid')
|
22
|
-
end
|
23
16
|
end
|
24
17
|
|
25
18
|
included do
|
@@ -34,20 +27,26 @@ module Hoardable
|
|
34
27
|
self.table_name = "#{table_name.singularize}#{VERSION_TABLE_SUFFIX}"
|
35
28
|
|
36
29
|
alias_method :readonly?, :persisted?
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
|
31
|
+
%i[operation event_uuid during].each do |symbol|
|
32
|
+
define_method("hoardable_#{symbol}") { public_send("_#{symbol}") }
|
33
|
+
end
|
40
34
|
|
41
35
|
# @!scope class
|
42
36
|
# @!method trashed
|
43
37
|
# @return [ActiveRecord<Object>]
|
44
38
|
#
|
45
39
|
# Returns only trashed +versions+ that are currently orphans.
|
46
|
-
scope
|
47
|
-
|
48
|
-
|
49
|
-
.where(
|
50
|
-
|
40
|
+
scope(
|
41
|
+
:trashed,
|
42
|
+
lambda do
|
43
|
+
left_outer_joins(:hoardable_source).where(
|
44
|
+
superclass.table_name => {
|
45
|
+
superclass.primary_key => nil
|
46
|
+
}
|
47
|
+
).where(_operation: "delete")
|
48
|
+
end
|
49
|
+
)
|
51
50
|
|
52
51
|
# @!scope class
|
53
52
|
# @!method at
|
@@ -61,7 +60,7 @@ module Hoardable
|
|
61
60
|
# @return [ActiveRecord<Object>]
|
62
61
|
#
|
63
62
|
# Returns +versions+ that were trashed at the supplied +datetime+ or +time+.
|
64
|
-
scope :trashed_at, ->(datetime) { where(_operation:
|
63
|
+
scope :trashed_at, ->(datetime) { where(_operation: "insert").where(DURING_QUERY, datetime) }
|
65
64
|
|
66
65
|
# @!scope class
|
67
66
|
# @!method with_hoardable_event_uuid
|
@@ -76,17 +75,19 @@ module Hoardable
|
|
76
75
|
# @return [ActiveRecord<Object>]
|
77
76
|
#
|
78
77
|
# Returns a limited +ActiveRecord+ scope of only the most recent version.
|
79
|
-
scope :only_most_recent, -> { limit(1).reorder(
|
78
|
+
scope :only_most_recent, -> { limit(1).reorder("UPPER(_during) DESC") }
|
80
79
|
end
|
81
80
|
|
82
81
|
# Reverts the parent +ActiveRecord+ instance to the saved attributes of this +version+. Raises
|
83
82
|
# an error if the version is trashed.
|
84
83
|
def revert!
|
85
|
-
raise(Error,
|
84
|
+
raise(Error, "Version is trashed, cannot revert") unless hoardable_operation == "update"
|
86
85
|
|
87
86
|
transaction do
|
88
87
|
hoardable_source.tap do |reverted|
|
89
|
-
reverted.reload.update!(
|
88
|
+
reverted.reload.update!(
|
89
|
+
hoardable_source_attributes.without(self.class.superclass.primary_key, "hoardable_id")
|
90
|
+
)
|
90
91
|
reverted.instance_variable_set(:@hoardable_version, self)
|
91
92
|
reverted.run_callbacks(:reverted)
|
92
93
|
end
|
@@ -96,29 +97,27 @@ module Hoardable
|
|
96
97
|
# Inserts a trashed +version+ back into its parent +ActiveRecord+ table with its original
|
97
98
|
# primary key. Raises an error if the version is not trashed.
|
98
99
|
def untrash!
|
99
|
-
raise(Error,
|
100
|
+
raise(Error, "Version is not trashed, cannot untrash") unless hoardable_operation == "delete"
|
100
101
|
|
101
102
|
transaction do
|
102
103
|
insert_untrashed_source.tap do |untrashed|
|
103
|
-
untrashed
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
untrashed
|
105
|
+
.send("hoardable_client")
|
106
|
+
.insert_hoardable_version("insert") do
|
107
|
+
untrashed.instance_variable_set(:@hoardable_version, self)
|
108
|
+
untrashed.run_callbacks(:untrashed)
|
109
|
+
end
|
107
110
|
end
|
108
111
|
end
|
109
112
|
end
|
110
113
|
|
111
|
-
DATA_KEYS.each
|
112
|
-
define_method("hoardable_#{key}") do
|
113
|
-
_data&.dig(key.to_s)
|
114
|
-
end
|
115
|
-
end
|
114
|
+
DATA_KEYS.each { |key| define_method("hoardable_#{key}") { _data&.dig(key.to_s) } }
|
116
115
|
|
117
116
|
# Returns the +ActiveRecord+
|
118
117
|
# {https://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changes changes} that
|
119
118
|
# were present during version creation.
|
120
119
|
def changes
|
121
|
-
_data&.dig(
|
120
|
+
_data&.dig("changes")
|
122
121
|
end
|
123
122
|
|
124
123
|
private
|
@@ -132,7 +131,7 @@ module Hoardable
|
|
132
131
|
def hoardable_source_attributes
|
133
132
|
attributes.without(
|
134
133
|
(self.class.column_names - self.class.superclass.column_names) +
|
135
|
-
|
134
|
+
self.class.columns.select(&:virtual?).map(&:name)
|
136
135
|
)
|
137
136
|
end
|
138
137
|
end
|
data/lib/hoardable.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
3
|
+
require "active_record"
|
4
|
+
require "fx"
|
5
|
+
require_relative "hoardable/version"
|
6
|
+
require_relative "hoardable/arel_visitors"
|
7
|
+
require_relative "hoardable/schema_statements"
|
8
|
+
require_relative "hoardable/schema_dumper"
|
9
|
+
require_relative "hoardable/engine"
|
10
|
+
require_relative "hoardable/finder_methods"
|
11
|
+
require_relative "hoardable/scopes"
|
12
|
+
require_relative "hoardable/error"
|
13
|
+
require_relative "hoardable/database_client"
|
14
|
+
require_relative "hoardable/source_model"
|
15
|
+
require_relative "hoardable/version_model"
|
16
|
+
require_relative "hoardable/model"
|
17
|
+
require_relative "hoardable/associations"
|
18
|
+
require_relative "hoardable/has_many"
|
19
|
+
require_relative "hoardable/belongs_to"
|
20
|
+
require_relative "hoardable/has_one"
|
21
|
+
require_relative "hoardable/has_rich_text"
|
22
|
+
require_relative "generators/hoardable/migration_generator"
|
23
|
+
require_relative "generators/hoardable/install_generator"
|
data/sig/hoardable.rbs
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# TypeProf 0.21.9
|
2
|
+
|
3
|
+
# Global variables
|
4
|
+
$thor_runner: false
|
5
|
+
$trace: false
|
6
|
+
|
7
|
+
# Classes
|
1
8
|
module Hoardable
|
2
9
|
VERSION: String
|
3
10
|
DATA_KEYS: [:meta, :whodunit, :event_uuid]
|
@@ -18,7 +25,7 @@ module Hoardable
|
|
18
25
|
def self.at: (untyped datetime) -> untyped
|
19
26
|
def self.logger: -> untyped
|
20
27
|
|
21
|
-
class Engine
|
28
|
+
class Engine < Rails::Engine
|
22
29
|
end
|
23
30
|
|
24
31
|
module FinderMethods
|
@@ -30,14 +37,7 @@ module Hoardable
|
|
30
37
|
end
|
31
38
|
|
32
39
|
module Scopes
|
33
|
-
|
34
|
-
self.@klass: bot
|
35
|
-
|
36
|
-
private
|
37
|
-
def tableoid: -> untyped
|
38
|
-
|
39
|
-
public
|
40
|
-
attr_writer tableoid: untyped
|
40
|
+
extend ActiveSupport::Concern
|
41
41
|
end
|
42
42
|
|
43
43
|
class Error < StandardError
|
@@ -47,14 +47,25 @@ module Hoardable
|
|
47
47
|
def initialize: (untyped source_table_name) -> void
|
48
48
|
end
|
49
49
|
|
50
|
+
class UpdatedAtColumnMissingError < Error
|
51
|
+
def initialize: (untyped source_table_name) -> void
|
52
|
+
end
|
53
|
+
|
50
54
|
class DatabaseClient
|
55
|
+
@generated_column_names: untyped
|
56
|
+
@refreshable_column_names: untyped
|
57
|
+
|
51
58
|
attr_reader source_record: SourceModel
|
52
59
|
def initialize: (SourceModel source_record) -> void
|
53
60
|
def insert_hoardable_version: (untyped operation) -> untyped
|
54
61
|
def source_primary_key: -> untyped
|
55
62
|
def find_or_initialize_hoardable_event_uuid: -> untyped
|
56
63
|
def initialize_version_attributes: (untyped operation) -> untyped
|
64
|
+
def has_one_find_conditions: (untyped reflection) -> Hash[String, nil]
|
65
|
+
def has_one_at_timestamp: -> untyped
|
57
66
|
def source_attributes_without_primary_key: -> untyped
|
67
|
+
def generated_column_names: -> Array[untyped]
|
68
|
+
def refreshable_column_names: -> untyped
|
58
69
|
def initialize_temporal_range: -> Range
|
59
70
|
def initialize_hoardable_data: -> untyped
|
60
71
|
def assign_hoardable_context: (:event_uuid | :meta | :whodunit key) -> nil
|
@@ -64,6 +75,7 @@ module Hoardable
|
|
64
75
|
end
|
65
76
|
|
66
77
|
module SourceModel
|
78
|
+
extend ActiveSupport::Concern
|
67
79
|
include Scopes
|
68
80
|
@hoardable_client: DatabaseClient
|
69
81
|
|
@@ -84,6 +96,8 @@ module Hoardable
|
|
84
96
|
end
|
85
97
|
|
86
98
|
module VersionModel
|
99
|
+
extend ActiveSupport::Concern
|
100
|
+
|
87
101
|
def revert!: -> untyped
|
88
102
|
def untrash!: -> untyped
|
89
103
|
def changes: -> untyped
|
@@ -94,10 +108,10 @@ module Hoardable
|
|
94
108
|
|
95
109
|
public
|
96
110
|
def version_class: -> VersionModel
|
97
|
-
def scope_attributes: -> untyped
|
98
111
|
end
|
99
112
|
|
100
113
|
module Model
|
114
|
+
extend ActiveSupport::Concern
|
101
115
|
include VersionModel
|
102
116
|
include SourceModel
|
103
117
|
include Associations
|
@@ -108,6 +122,7 @@ module Hoardable
|
|
108
122
|
end
|
109
123
|
|
110
124
|
module Associations
|
125
|
+
extend ActiveSupport::Concern
|
111
126
|
include HasRichText
|
112
127
|
include BelongsTo
|
113
128
|
include HasOne
|
@@ -115,6 +130,8 @@ module Hoardable
|
|
115
130
|
end
|
116
131
|
|
117
132
|
module HasMany
|
133
|
+
extend ActiveSupport::Concern
|
134
|
+
|
118
135
|
def has_many: (*untyped args) -> untyped
|
119
136
|
|
120
137
|
module HasManyExtension
|
@@ -129,6 +146,8 @@ module Hoardable
|
|
129
146
|
end
|
130
147
|
|
131
148
|
module BelongsTo
|
149
|
+
extend ActiveSupport::Concern
|
150
|
+
|
132
151
|
def belongs_to: (*untyped args) -> nil
|
133
152
|
|
134
153
|
private
|
@@ -136,25 +155,31 @@ module Hoardable
|
|
136
155
|
end
|
137
156
|
|
138
157
|
module HasOne
|
158
|
+
extend ActiveSupport::Concern
|
159
|
+
|
139
160
|
def has_one: (*untyped args) -> nil
|
140
161
|
end
|
141
162
|
|
142
163
|
module HasRichText
|
164
|
+
extend ActiveSupport::Concern
|
165
|
+
|
143
166
|
def has_rich_text: (untyped name, ?encrypted: false, ?hoardable: false) -> nil
|
144
167
|
end
|
145
168
|
|
146
|
-
class MigrationGenerator
|
169
|
+
class MigrationGenerator < ActiveRecord::Generators::Base
|
147
170
|
@singularized_table_name: untyped
|
148
171
|
|
149
172
|
def create_versions_table: -> untyped
|
173
|
+
def create_triggers: -> {versions_prevent_update: untyped, set_hoardable_id: untyped, prevent_update_hoardable_id: untyped}
|
150
174
|
def foreign_key_type: -> String
|
151
175
|
def primary_key: -> String
|
152
176
|
def singularized_table_name: -> untyped
|
153
177
|
end
|
154
178
|
|
155
|
-
class InstallGenerator
|
179
|
+
class InstallGenerator < Rails::Generators::Base
|
156
180
|
def create_initializer_file: -> untyped
|
157
181
|
def create_migration_file: -> untyped
|
182
|
+
def create_functions: -> Array[String]
|
158
183
|
def self.next_migration_number: (untyped dir) -> untyped
|
159
184
|
end
|
160
185
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoardable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- justin talbott
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,60 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '8'
|
19
|
+
version: '7'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '8'
|
26
|
+
version: '7'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: activesupport
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
- - "<"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '8'
|
33
|
+
version: '7'
|
43
34
|
type: :runtime
|
44
35
|
prerelease: false
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
46
37
|
requirements:
|
47
38
|
- - ">="
|
48
39
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
-
- - "<"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '8'
|
40
|
+
version: '7'
|
53
41
|
- !ruby/object:Gem::Dependency
|
54
42
|
name: railties
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
56
44
|
requirements:
|
57
45
|
- - ">="
|
58
46
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
60
|
-
- - "<"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '8'
|
47
|
+
version: '7'
|
63
48
|
type: :runtime
|
64
49
|
prerelease: false
|
65
50
|
version_requirements: !ruby/object:Gem::Requirement
|
66
51
|
requirements:
|
67
52
|
- - ">="
|
68
53
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
70
|
-
- - "<"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '8'
|
54
|
+
version: '7'
|
73
55
|
- !ruby/object:Gem::Dependency
|
74
56
|
name: fx
|
75
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +99,7 @@ executables: []
|
|
117
99
|
extensions: []
|
118
100
|
extra_rdoc_files: []
|
119
101
|
files:
|
120
|
-
- ".
|
102
|
+
- ".streerc"
|
121
103
|
- ".tool-versions"
|
122
104
|
- CHANGELOG.md
|
123
105
|
- Gemfile
|
@@ -135,6 +117,7 @@ files:
|
|
135
117
|
- lib/generators/hoardable/triggers/set_hoardable_id.sql
|
136
118
|
- lib/generators/hoardable/triggers/versions_prevent_update.sql
|
137
119
|
- lib/hoardable.rb
|
120
|
+
- lib/hoardable/arel_visitors.rb
|
138
121
|
- lib/hoardable/associations.rb
|
139
122
|
- lib/hoardable/belongs_to.rb
|
140
123
|
- lib/hoardable/database_client.rb
|
@@ -147,6 +130,8 @@ files:
|
|
147
130
|
- lib/hoardable/has_rich_text.rb
|
148
131
|
- lib/hoardable/model.rb
|
149
132
|
- lib/hoardable/rich_text.rb
|
133
|
+
- lib/hoardable/schema_dumper.rb
|
134
|
+
- lib/hoardable/schema_statements.rb
|
150
135
|
- lib/hoardable/scopes.rb
|
151
136
|
- lib/hoardable/source_model.rb
|
152
137
|
- lib/hoardable/version.rb
|
@@ -167,14 +152,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
152
|
requirements:
|
168
153
|
- - ">="
|
169
154
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
155
|
+
version: '3.0'
|
171
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
157
|
requirements:
|
173
158
|
- - ">="
|
174
159
|
- !ruby/object:Gem::Version
|
175
160
|
version: '0'
|
176
161
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.5.6
|
178
163
|
signing_key:
|
179
164
|
specification_version: 4
|
180
165
|
summary: An ActiveRecord extension for versioning and soft-deletion of records in
|
data/.rubocop.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.7
|
3
|
-
NewCops: enable
|
4
|
-
SuggestExtensions: false
|
5
|
-
|
6
|
-
Layout/LineLength:
|
7
|
-
Max: 120
|
8
|
-
|
9
|
-
Metrics/ClassLength:
|
10
|
-
Exclude:
|
11
|
-
- 'test/**/*.rb'
|
12
|
-
|
13
|
-
Metrics/BlockLength:
|
14
|
-
Exclude:
|
15
|
-
- 'test/**/*.rb'
|
16
|
-
|
17
|
-
Style/DocumentDynamicEvalDefinition:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Naming/PredicateName:
|
21
|
-
Enabled: false
|