scenic-oracle_adapter 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docker-compose.yml +0 -2
- data/lib/scenic/adapters/oracle.rb +26 -7
- data/lib/scenic/oracle_adapter/version.rb +1 -1
- data/lib/tsortable_hash.rb +2 -2
- 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: 453bc175d2fa922a314a781064fb63a6415dc3be36aa096baa9d52c77f1542ed
|
4
|
+
data.tar.gz: 3d5ed519bc3ce673c934bc32d310b298c8d525e12fd089abf8a1201674036d4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0722b1989112a9b5f48c7fdbd7b303d4fd7baf5b577dc002bcd9d174e795b120715b725ffdd72cc562f7522b09a9eea13cc8e4984dccd53d929bdea2b1b0c4
|
7
|
+
data.tar.gz: df2366ae4965f197b205f7148ecef307f17695f3c05815b17ee681bf230b53c2bb1edfc7831b854d590022422fbfc42c3ce00e526ff7d14f719ecc8399ae5ce6
|
data/docker-compose.yml
CHANGED
@@ -13,13 +13,11 @@ module Scenic
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def views
|
16
|
-
|
17
|
-
dependency_order.index(view_object.name)
|
18
|
-
end
|
16
|
+
sorted_dependency_views + sorted_missing_dependency_views
|
19
17
|
end
|
20
18
|
|
21
19
|
def create_view(name, definition)
|
22
|
-
execute("create view #{quote_table_name(name)} as #{definition}")
|
20
|
+
execute("create view #{quote_table_name(name)} as #{trimmed_definition(definition)}")
|
23
21
|
end
|
24
22
|
|
25
23
|
def drop_view(name)
|
@@ -27,7 +25,7 @@ module Scenic
|
|
27
25
|
end
|
28
26
|
|
29
27
|
def replace_view(name, definition)
|
30
|
-
execute("create or replace view #{quote_table_name(name)} as #{definition}")
|
28
|
+
execute("create or replace view #{quote_table_name(name)} as #{trimmed_definition(definition)}")
|
31
29
|
end
|
32
30
|
|
33
31
|
def update_view(name, definition)
|
@@ -36,7 +34,7 @@ module Scenic
|
|
36
34
|
end
|
37
35
|
|
38
36
|
def create_materialized_view(name, definition, no_data: false)
|
39
|
-
execute("create materialized view #{quote_table_name(name)} #{'build deferred' if no_data} as #{definition}")
|
37
|
+
execute("create materialized view #{quote_table_name(name)} #{'build deferred' if no_data} as #{trimmed_definition(definition)}")
|
40
38
|
end
|
41
39
|
|
42
40
|
def update_materialized_view(name, definition, no_data: false)
|
@@ -71,7 +69,7 @@ module Scenic
|
|
71
69
|
private
|
72
70
|
|
73
71
|
def view_dependencies
|
74
|
-
select_all(<<~EOSQL)
|
72
|
+
@view_dependencies ||= select_all(<<~EOSQL)
|
75
73
|
select lower(uo.object_name) as name, lower(ud.referenced_name) as dependency
|
76
74
|
from user_objects uo
|
77
75
|
left join user_dependencies ud on
|
@@ -88,6 +86,7 @@ module Scenic
|
|
88
86
|
and ud.referenced_name in (select object_name from user_objects)
|
89
87
|
and ud.referenced_owner = user
|
90
88
|
where uo.object_type in ('VIEW', 'MATERIALIZED VIEW')
|
89
|
+
order by lower(uo.object_name), lower(ud.referenced_name)
|
91
90
|
EOSQL
|
92
91
|
end
|
93
92
|
|
@@ -102,6 +101,22 @@ module Scenic
|
|
102
101
|
views_hash.tsort
|
103
102
|
end
|
104
103
|
|
104
|
+
def sorted_dependency_views
|
105
|
+
all_view_objects.filter do |view|
|
106
|
+
dependency_order.include?(view.name)
|
107
|
+
end.sort_by do |view|
|
108
|
+
dependency_order.index(view.name)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def sorted_missing_dependency_views
|
113
|
+
all_view_objects.filter do |view|
|
114
|
+
dependency_order.exclude?(view.name)
|
115
|
+
end.sort_by do |view|
|
116
|
+
view.name
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
105
120
|
def all_views
|
106
121
|
select_all("select lower(view_name) name, text definition from user_views").map do |view|
|
107
122
|
Scenic::View.new(name: view["name"], definition: view["definition"], materialized: false)
|
@@ -121,6 +136,10 @@ module Scenic
|
|
121
136
|
def refresh_dependencies_for(name)
|
122
137
|
Scenic::Adapters::Oracle::RefreshDependencies.call(name, self, connection)
|
123
138
|
end
|
139
|
+
|
140
|
+
def trimmed_definition(sql)
|
141
|
+
sql.strip.sub(/;$/, "").strip
|
142
|
+
end
|
124
143
|
end
|
125
144
|
end
|
126
145
|
end
|
data/lib/tsortable_hash.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scenic-oracle_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Dinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scenic
|