spectacles 7.0.0 → 7.1.0

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: 3828ebda72819be07a7e380017782c6ce623c556b7a55a66b0817c8274bc5699
4
- data.tar.gz: c8202a385e3fef197c8db980ee53f0f104c3310608a46c60cb5756aa2526ed9c
3
+ metadata.gz: ebcfad8ca1527984b7bf22860daf4656fe0db3b78b986b065e6286b8f2c7e943
4
+ data.tar.gz: 4a87cb7d3dee9023221a0bed897e29e7592f38b81f554030b4fe504ad6e985c5
5
5
  SHA512:
6
- metadata.gz: 0204f98f169707aee585e76e7b3f61fff5639e42bb3b7655e0a2c2c0c54a4dea2891c8edcd5c85a498f1dce4c4e169c0ab9793c145f7be4e2960e90973307550
7
- data.tar.gz: a8f20c62cca8e1c8868d12522f9e37ac5826fd9e1f5b25357929be2f256a020f913a227563f81d0203ec3e2b866c61639a255dde24fd450f8d3a3e7b864b5d48
6
+ metadata.gz: 3d2a1aefe4922fcf1c1629423663abf5e3ed30da482bf2921dc2a732a72dd98754c24e9632b2d75a35ee4f1694aa72fc90138983f6a54906828bc85145598259
7
+ data.tar.gz: 6e37baa5ae6ea93119ccdae0e8ad588e98f25b34b110f5bdccaef3467cb4da3d57d00125d58ccd70c25dd798e41f10f0ac642d11f09e02135e1bf5e3d01f5d24
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [7.1.0] – 2024-11-27
9
+
10
+ - Require Rails 7.1
11
+
8
12
  ## [7.0.0] – 2024-11-26
9
13
 
10
14
  - Add support for dumping views from multiple schemas in Postgres ([#32](https://github.com/liveh2o/spectacles/pull/32))
@@ -3,34 +3,14 @@ module Spectacles
3
3
  module Mysql2Adapter
4
4
  include Spectacles::SchemaStatements::AbstractAdapter
5
5
 
6
- # overrides the #tables method from ActiveRecord's MysqlAdapter
7
- # to return only tables, and not views.
8
- def tables(name = nil, database = nil, like = nil)
9
- database = database ? quote_table_name(database) : "DATABASE()"
10
- by_name = like ? "AND table_name LIKE #{quote(like)}" : ""
11
-
12
- sql = <<-SQL.squish
13
- SELECT table_name, table_type
14
- FROM information_schema.tables
15
- WHERE table_schema = #{database}
16
- AND table_type = 'BASE TABLE'
17
- #{by_name}
18
- SQL
19
-
20
- execute_and_free(sql, "SCHEMA") do |result|
21
- rows_from(result).map(&:first)
22
- end
23
- end
24
-
25
6
  def views(name = nil) # :nodoc:
26
7
  result = execute("SHOW FULL TABLES WHERE TABLE_TYPE='VIEW'")
27
-
28
- rows_from(result).map(&:first)
8
+ values_from(result).map(&:first)
29
9
  end
30
10
 
31
11
  def view_build_query(view, name = nil)
32
12
  result = execute("SHOW CREATE VIEW #{view}", name)
33
- algorithm_string = rows_from(result).first[1]
13
+ algorithm_string = values_from(result).first[1]
34
14
 
35
15
  algorithm_string.gsub(/CREATE .*? (AS)+/i, "")
36
16
  rescue ActiveRecord::StatementInvalid => e
@@ -39,8 +19,8 @@ module Spectacles
39
19
 
40
20
  private
41
21
 
42
- def rows_from(result)
43
- result.respond_to?(:rows) ? result.rows : result
22
+ def values_from(result)
23
+ result.first.respond_to?(:values) ? result.map(&:values) : result
44
24
  end
45
25
  end
46
26
  end
@@ -5,21 +5,6 @@ module Spectacles
5
5
  module SQLite3Adapter
6
6
  include Spectacles::SchemaStatements::AbstractAdapter
7
7
 
8
- # overrides the #tables method from ActiveRecord's SQLite3Adapter
9
- # to return only tables, and not views.
10
- def tables(name = nil, table_name = nil)
11
- sql = <<-SQL
12
- SELECT name
13
- FROM sqlite_master
14
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
15
- SQL
16
- sql << " AND name = #{quote_table_name(table_name)}" if table_name
17
-
18
- exec_query(sql, "SCHEMA").map do |row|
19
- row["name"]
20
- end
21
- end
22
-
23
8
  def generate_view_query(*columns)
24
9
  <<-SQL
25
10
  SELECT #{columns.join(",")}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spectacles
4
- VERSION = "7.0.0"
4
+ VERSION = "7.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectacles
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hutchison, Brandon Dewitt
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: 7.1.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
- version: 7.0.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 7.0.0
33
+ version: 7.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 7.0.0
40
+ version: 7.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.4.6
135
+ rubygems_version: 3.4.22
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Spectacles adds database view functionality to ActiveRecord.