scenic-oracle_adapter 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 533aa27e5aab91d23478730a7330bc9d08c343ddd5de1bfa8191ed18e2ed9dd6
4
- data.tar.gz: b8461d886bca7de8feb790fa12bdb59a550e81b5fd12f292ff5008b55e6db769
3
+ metadata.gz: b6af72024c360af2c3e802a98dad25c65109fd6d79eda9b7a0d6e43c4829d92f
4
+ data.tar.gz: 6c3c8e11b6676d69dc79893a2196f7e0a5f8babb04d20e714d2f63b1d5f00d67
5
5
  SHA512:
6
- metadata.gz: 784827c8e18df5276b914921aded3c4b8ccb57ee5fa0993ef88eca4a1b8023df93983cb05e17b4a620e71d27dd20afb9fcf86bb31dd2b2a18ac3fb057d80aa8d
7
- data.tar.gz: 04e19cc856521843c40fd06ca4bd0bd2e4f5e1389251bc63949a34be45e294edb64f35fb6778ffb50581ab479b96f3658e169a59c5a44e0ebefad298ef269cd1
6
+ metadata.gz: 2df4de941f6d6536a225811124efeb2423e186f4ea741b58d6144019c77252cf7b98c203e9dde881325b7892f75cae27b22764acf2f2170ca2262230d4671e34
7
+ data.tar.gz: 2eb947aa0e7d850bcd9a6aceaa9abda6fad9eab0fd9d4b68a26c54683d1054132ce849a4f0a47c4f7d6a3e8c4563a89572096008396860ac0872b06cc059c36a
@@ -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 --platform=linux/amd64 ruby:latest
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-compose.
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-compose exec` to run commands on the already running containers:
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-compose exec gem bin/test`
34
- - Open a console: `docker-compose exec gem bin/console`
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,14 +1,12 @@
1
- version: '3'
2
1
  services:
3
2
  db:
4
- image: container-registry.oracle.com/database/express:latest
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:
@@ -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
- all_views + all_mviews
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,29 @@ 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
+ and ud.referenced_name in (select object_name from user_objects)
80
+ and ud.referenced_owner = user
81
+ where uo.object_type in ('VIEW', 'MATERIALIZED VIEW')
82
+ EOSQL
83
+ end
84
+
85
+ def dependency_order
86
+ views_hash = TSortableHash.new
87
+
88
+ view_dependencies.each do |view_data|
89
+ views_hash[view_data["name"]] ||= []
90
+ views_hash[view_data["name"]] << view_data["dependency"] unless view_data["dependency"].nil?
91
+ end
92
+
93
+ views_hash.tsort
94
+ end
95
+
70
96
  def all_views
71
97
  select_all("select lower(view_name) name, text definition from user_views").map do |view|
72
98
  Scenic::View.new(name: view["name"], definition: view["definition"], materialized: false)
@@ -79,6 +105,10 @@ module Scenic
79
105
  end
80
106
  end
81
107
 
108
+ def all_view_objects
109
+ all_views + all_mviews
110
+ end
111
+
82
112
  def refresh_dependencies_for(name)
83
113
  Scenic::Adapters::Oracle::RefreshDependencies.call(name, self, connection)
84
114
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scenic
4
4
  module OracleAdapter
5
- VERSION = "1.3.0"
5
+ VERSION = "1.3.2"
6
6
  end
7
7
  end
@@ -0,0 +1,10 @@
1
+ require "tsort"
2
+
3
+ class TSortableHash < Hash
4
+ include TSort
5
+
6
+ alias_method :tsort_each_node, :each_key
7
+ def tsort_each_child(node, &)
8
+ fetch(node).each(&)
9
+ end
10
+ 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", ">= 1.8.0"
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.0
4
+ version: 1.3.2
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-29 00:00:00.000000000 Z
11
+ date: 2024-07-04 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.4
161
+ rubygems_version: 3.5.9
161
162
  signing_key:
162
163
  specification_version: 4
163
164
  summary: Oracle adapter for thoughtbot/scenic