scenic-oracle_adapter 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +0 -5
- data/Dockerfile +1 -13
- data/README.md +4 -4
- data/docker-compose.yml +1 -5
- data/lib/scenic/adapters/oracle.rb +29 -1
- data/lib/scenic/oracle_adapter/version.rb +1 -1
- data/lib/tsortable_hash.rb +10 -0
- data/scenic-oracle_adapter.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9bb94f1cec86d7abe41786c15d0bac531eef9b082099f8d4d498f0dee898a8
|
4
|
+
data.tar.gz: 3e2131ed37270bb8f39f8e7bdb67d82561461f266a59fa9387824282620f31d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a44e897ba0001c0e8f293c13648bf6062ac06d3980211515058ef80e1a4651a583434560d00420fcb4021d6953216ba0cda670378c0787bb4d6a259c46846b3a
|
7
|
+
data.tar.gz: 31c7ed943ce55a201b589da0c08cfa04cb6a27ee05dce313a7d5f229949973c997e4ee88e17f58ef936509ca9edca97b23754d722472db6361bb589b44ee98d7
|
data/.github/workflows/ci.yml
CHANGED
@@ -12,10 +12,5 @@ jobs:
|
|
12
12
|
|
13
13
|
steps:
|
14
14
|
- uses: actions/checkout@v2
|
15
|
-
- name: Login to Docker Hub
|
16
|
-
uses: docker/login-action@v1
|
17
|
-
with:
|
18
|
-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
19
|
-
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
20
15
|
- name: Run tests
|
21
16
|
run: docker-compose run gem rspec
|
data/Dockerfile
CHANGED
@@ -1,16 +1,4 @@
|
|
1
|
-
FROM
|
2
|
-
|
3
|
-
RUN curl -sLO 'https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip' && \
|
4
|
-
curl -sLO 'https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip' && \
|
5
|
-
unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
|
6
|
-
unzip instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip && \
|
7
|
-
rm instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && \
|
8
|
-
rm instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip
|
9
|
-
|
10
|
-
RUN apt update && \
|
11
|
-
apt-get install libaio1
|
12
|
-
|
13
|
-
ENV LD_LIBRARY_PATH /instantclient_19_6:$LD_LIBRARY_PATH
|
1
|
+
FROM ghcr.io/cdinger/oracle-ruby:3.3
|
14
2
|
|
15
3
|
RUN mkdir /app
|
16
4
|
WORKDIR /app
|
data/README.md
CHANGED
@@ -26,12 +26,12 @@ end
|
|
26
26
|
|
27
27
|
## Development
|
28
28
|
|
29
|
-
While you can use any Oracle instance for development, it's easiest to use Docker and docker
|
29
|
+
While you can use any Oracle instance for development, it's easiest to use Docker and docker compose.
|
30
30
|
|
31
|
-
Note that the Oracle container takes up to two minutes to start and become available. If you're doing active development you probably want to start the containers in detached mode: `docker-compose up -d`. This starts everything in the background and allows you to use `docker
|
31
|
+
Note that the Oracle container takes up to two minutes to start and become available. If you're doing active development you probably want to start the containers in detached mode: `docker-compose up -d`. This starts everything in the background and allows you to use `docker compose exec` to run commands on the already running containers:
|
32
32
|
|
33
|
-
- Run specs: `docker
|
34
|
-
- Open a console: `docker
|
33
|
+
- Run specs: `docker compose exec gem bin/test`
|
34
|
+
- Open a console: `docker compose exec gem bin/console`
|
35
35
|
|
36
36
|
## Tests
|
37
37
|
|
data/docker-compose.yml
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
version: '3'
|
2
1
|
services:
|
3
2
|
db:
|
4
|
-
image:
|
3
|
+
image: ghcr.io/cdinger/oracle:19.3.0-ee
|
5
4
|
volumes:
|
6
5
|
- db:/opt/oracle/oradata
|
7
6
|
environment:
|
8
7
|
- ORACLE_PWD=thisisonlyusedlocally
|
9
8
|
ports:
|
10
9
|
- "127.0.0.1:1521:1521"
|
11
|
-
- "127.0.0.1:5500:5500"
|
12
10
|
gem:
|
13
11
|
build: .
|
14
12
|
volumes:
|
15
13
|
- .:/app
|
16
|
-
environment:
|
17
|
-
- TERM=dumb
|
18
14
|
stdin_open: true
|
19
15
|
tty: true
|
20
16
|
depends_on:
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "oracle/index_reapplication"
|
4
4
|
require_relative "oracle/indexes"
|
5
5
|
require_relative "oracle/refresh_dependencies"
|
6
|
+
require "tsortable_hash"
|
6
7
|
|
7
8
|
module Scenic
|
8
9
|
module Adapters
|
@@ -12,7 +13,9 @@ module Scenic
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def views
|
15
|
-
|
16
|
+
all_view_objects.sort_by do |view_object|
|
17
|
+
dependency_order.index(view_object.name)
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
def create_view(name, definition)
|
@@ -67,6 +70,27 @@ module Scenic
|
|
67
70
|
|
68
71
|
private
|
69
72
|
|
73
|
+
def view_dependencies
|
74
|
+
select_all(<<~EOSQL)
|
75
|
+
select lower(uo.object_name) as name, lower(ud.referenced_name) as dependency
|
76
|
+
from user_objects uo
|
77
|
+
left join user_dependencies ud on uo.object_name = ud.name
|
78
|
+
and ud.referenced_type in ('VIEW', 'MATERIALIZED VIEW')
|
79
|
+
where uo.object_type in ('VIEW', 'MATERIALIZED VIEW')
|
80
|
+
EOSQL
|
81
|
+
end
|
82
|
+
|
83
|
+
def dependency_order
|
84
|
+
views_hash = TSortableHash.new
|
85
|
+
|
86
|
+
view_dependencies.each do |view_data|
|
87
|
+
views_hash[view_data["name"]] ||= []
|
88
|
+
views_hash[view_data["name"]] << view_data["dependency"] unless view_data["dependency"].nil?
|
89
|
+
end
|
90
|
+
|
91
|
+
views_hash.tsort
|
92
|
+
end
|
93
|
+
|
70
94
|
def all_views
|
71
95
|
select_all("select lower(view_name) name, text definition from user_views").map do |view|
|
72
96
|
Scenic::View.new(name: view["name"], definition: view["definition"], materialized: false)
|
@@ -79,6 +103,10 @@ module Scenic
|
|
79
103
|
end
|
80
104
|
end
|
81
105
|
|
106
|
+
def all_view_objects
|
107
|
+
all_views + all_mviews
|
108
|
+
end
|
109
|
+
|
82
110
|
def refresh_dependencies_for(name)
|
83
111
|
Scenic::Adapters::Oracle::RefreshDependencies.call(name, self, connection)
|
84
112
|
end
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_dependency "scenic", "
|
25
|
+
spec.add_dependency "scenic", "= 1.8.0"
|
26
26
|
spec.add_dependency "activerecord-oracle_enhanced-adapter", ">= 1.5.0"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 2.0"
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
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.1
|
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-03
|
11
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scenic
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/scenic/adapters/oracle/refresh_dependencies.rb
|
138
138
|
- lib/scenic/oracle_adapter.rb
|
139
139
|
- lib/scenic/oracle_adapter/version.rb
|
140
|
+
- lib/tsortable_hash.rb
|
140
141
|
- scenic-oracle_adapter.gemspec
|
141
142
|
homepage: https://github.com/cdinger/scenic-oracle_adapter
|
142
143
|
licenses:
|
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
requirements: []
|
160
|
-
rubygems_version: 3.5.
|
161
|
+
rubygems_version: 3.5.9
|
161
162
|
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: Oracle adapter for thoughtbot/scenic
|