motor-admin 0.4.32 → 0.4.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/motor/audit.rb +12 -10
- data/lib/motor/queries/postgresql_exec_query.rb +22 -13
- data/lib/motor/resources/fetch_configured_model.rb +18 -6
- data/lib/motor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8c50645e3228b532c70c3455ed170c59c21d7e69f5a0170f13c43174fe6e0c9
|
4
|
+
data.tar.gz: 3a50a9787112c88af0a5f39ebc2cb23394f240f694ea8a335641456ab64669d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 194f2226d32361a5e1a7ace3f8a49431d4a3d190714741930e8716f1482083907459769b65399235b5c4da0702adc1acc27cd1da0b44427ba97978cbdb58a872
|
7
|
+
data.tar.gz: 5a26102b3cd126a565ddbe479c10c30ac99e36c1675a088229b5fd3b09965e2387fad2b9fe219819764bb482496468b5e7ba4ccc59856d62114aa33a2b4b57e3
|
data/app/models/motor/audit.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
unless defined?(Motor::Audit)
|
4
|
+
module Motor
|
5
|
+
class Audit < Audited::Audit
|
6
|
+
self.table_name = 'motor_audits'
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
if Rails.version.to_f >= 7.2
|
9
|
+
superclass.abstract_class = true
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if Rails.version.to_f >= 7.1
|
13
|
+
serialize :audited_changes, coder: HashSerializer
|
14
|
+
else
|
15
|
+
serialize :audited_changes, HashSerializer
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -6,21 +6,30 @@ module Motor
|
|
6
6
|
module_function
|
7
7
|
|
8
8
|
def call(conn, statement)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
fmod = result.fmod i
|
16
|
-
types[fname] = conn.send(:get_oid_type, ftype, fmod, fname)
|
9
|
+
if Rails.version.to_f >= 8.0
|
10
|
+
result = conn.send(:internal_execute, *statement)
|
11
|
+
process_result(conn, result)
|
12
|
+
else
|
13
|
+
conn.send(:execute_and_clear, *statement) do |result|
|
14
|
+
process_result(conn, result)
|
17
15
|
end
|
16
|
+
end
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
def process_result(conn, result)
|
20
|
+
types = {}
|
21
|
+
fields = result.fields
|
22
|
+
|
23
|
+
fields.each_with_index do |fname, i|
|
24
|
+
ftype = result.ftype i
|
25
|
+
fmod = result.fmod i
|
26
|
+
types[fname] = conn.send(:get_oid_type, ftype, fmod, fname)
|
27
|
+
end
|
28
|
+
|
29
|
+
if conn.respond_to?(:build_result, true)
|
30
|
+
conn.send(:build_result, columns: fields, rows: result.values, column_types: types)
|
31
|
+
else
|
32
|
+
ActiveRecord::Result.new(fields, result.values, types)
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -110,15 +110,27 @@ module Motor
|
|
110
110
|
|
111
111
|
columns = Resources::CustomSqlColumnsCache.call(config[:custom_sql])
|
112
112
|
|
113
|
+
base_column = klass.connection.schema_cache.columns_hash(klass.table_name).first.last
|
114
|
+
|
113
115
|
columns_hash =
|
114
116
|
columns.each_with_object({}) do |column, acc|
|
115
117
|
acc[column[:name]] =
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
if Rails.version.to_f >= 7.2
|
119
|
+
base_column.class.new(
|
120
|
+
column[:name],
|
121
|
+
nil,
|
122
|
+
base_column.sql_type_metadata.class.new(
|
123
|
+
ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(sql_type: column[:column_type],
|
124
|
+
type: column[:column_type].to_sym))
|
125
|
+
)
|
126
|
+
else
|
127
|
+
ActiveRecord::ConnectionAdapters::Column.new(
|
128
|
+
column[:name],
|
129
|
+
nil,
|
130
|
+
ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(sql_type: column[:column_type],
|
131
|
+
type: column[:column_type].to_sym)
|
132
|
+
)
|
133
|
+
end
|
122
134
|
end
|
123
135
|
|
124
136
|
klass.instance_variable_set(:@__motor_custom_sql_columns_hash, columns_hash)
|
data/lib/motor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motor-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ar_lazy_preload
|