spectacles 7.0.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/spectacles/schema_statements/mysql2_adapter.rb +4 -24
- data/lib/spectacles/schema_statements/sqlite3_adapter.rb +0 -15
- data/lib/spectacles/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88aa8d11903ba0ea9d269363b01f23418dab60c4ee9d4ce8971291d49045cd29
|
4
|
+
data.tar.gz: d78529d1af8f1c1c057705ef8c16c4f9aba1a93d5faf2f07b3f6e2d1982b7679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aef46ed08ce667a97f9cc552a76c2403151e3a6edbca4136e7078d1fb08527b9e8aa53ccdb946a807bd26902e38837da449ab348a9eb14d7ba286dc7c274cf2e
|
7
|
+
data.tar.gz: ef567df24ece22cb897e3ee738972fa9964b9a36810743d0b7189cf4886c0ca862996814400e52b3e5605e2e7d9bddea9ade399d2ce0ee617ec6540b3d5067c5
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [7.2.0] – 2024-11-27
|
9
|
+
|
10
|
+
- Require Ruby 3.1+
|
11
|
+
- Require Rails 7.2
|
12
|
+
|
13
|
+
## [7.1.0] – 2024-11-27
|
14
|
+
|
15
|
+
- Require Rails 7.1
|
16
|
+
|
8
17
|
## [7.0.0] – 2024-11-26
|
9
18
|
|
10
19
|
- 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 =
|
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
|
43
|
-
result.respond_to?(:
|
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(",")}
|
data/lib/spectacles/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectacles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison, Brandon Dewitt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-11-27 00:00:00.000000000 Z
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.
|
19
|
+
version: 7.2.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.
|
26
|
+
version: 7.2.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.
|
33
|
+
version: 7.2.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.
|
40
|
+
version: 7.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ metadata:
|
|
117
117
|
homepage_uri: http://github.com/liveh2o/spectacles
|
118
118
|
source_code_uri: http://github.com/liveh2o/spectacles
|
119
119
|
changelog_uri: http://github.com/liveh2o/spectacles/blob/main/CHANGELOG.md
|
120
|
-
post_install_message:
|
120
|
+
post_install_message:
|
121
121
|
rdoc_options: []
|
122
122
|
require_paths:
|
123
123
|
- lib
|
@@ -125,15 +125,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
128
|
+
version: 3.1.0
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
-
signing_key:
|
135
|
+
rubygems_version: 3.3.27
|
136
|
+
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Spectacles adds database view functionality to ActiveRecord.
|
139
139
|
test_files: []
|