pg_saurus 4.0.0 → 4.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4621e5c56482cf923810bd206b2449469102f56a92a55acf002d004c5664675
|
4
|
+
data.tar.gz: 8c5b2e568586c128e7d0a248ef6cdd2b8c1f67e8e02e888fa4f2eee5bcd8adde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d730184e0b65c57e7a894abf10d26e2553e5b627d92ed211a9b93a7e3e1e163eb95ef3429ea837509e0d1caa5607efc29655446411b51111f90dddd7d7be59
|
7
|
+
data.tar.gz: 5256f3a310c2a8d5586477ee0a0f45c208a02b60ab0720632f26bcaf9b0fa428b546fa6b9ff825b2b8fc2d1e872e5939eefbda75036d93f3486b4485d3dbcbc7
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
# PostgreSQL-specific extensions to column definitions in a table.
|
4
|
+
class PostgreSQLColumn < Column #:nodoc:
|
5
|
+
# == Patch 1:
|
6
|
+
# Remove schema name part from table name when sequence name doesn't include it.
|
7
|
+
def serial?
|
8
|
+
return unless default_function
|
9
|
+
|
10
|
+
if %r{\Anextval\('"?(?<sequence_name>.+_(?<suffix>seq\d*))"?'::regclass\)\z} =~ default_function
|
11
|
+
is_schema_name_included = sequence_name.split(".").size > 1
|
12
|
+
_table_name = is_schema_name_included ? table_name : table_name.split(".").last
|
13
|
+
|
14
|
+
sequence_name_from_parts(_table_name, name, suffix) == sequence_name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -15,6 +15,21 @@ module ActiveRecord
|
|
15
15
|
# Regex to find where clause in index statements
|
16
16
|
INDEX_WHERE_EXPRESSION = /WHERE (.+)$/
|
17
17
|
|
18
|
+
# Returns the list of all tables in the schema search path or a specified schema.
|
19
|
+
#
|
20
|
+
# == Patch:
|
21
|
+
# If current user is not `postgres` original method return all tables from all schemas
|
22
|
+
# without schema prefix. This disables such behavior by querying only default schema.
|
23
|
+
# Tables with schemas will be queried later.
|
24
|
+
#
|
25
|
+
def tables(name = nil)
|
26
|
+
query(<<-SQL, 'SCHEMA').map { |row| row[0] }
|
27
|
+
SELECT tablename
|
28
|
+
FROM pg_tables
|
29
|
+
WHERE schemaname = ANY (ARRAY['public'])
|
30
|
+
SQL
|
31
|
+
end
|
32
|
+
|
18
33
|
# Returns an array of indexes for the given table.
|
19
34
|
#
|
20
35
|
# == Patch 1:
|
data/lib/pg_saurus/engine.rb
CHANGED
@@ -5,7 +5,10 @@ module PgSaurus
|
|
5
5
|
initializer "pg_saurus" do
|
6
6
|
ActiveSupport.on_load(:active_record) do
|
7
7
|
# load monkey patches
|
8
|
-
%w(schema_dumper
|
8
|
+
%w(schema_dumper
|
9
|
+
errors
|
10
|
+
connection_adapters/postgresql/schema_statements
|
11
|
+
connection_adapters/postgresql/column).each do |path|
|
9
12
|
require ::PgSaurus::Engine.root + "lib/core_ext/active_record/" + path
|
10
13
|
end
|
11
14
|
|
data/lib/pg_saurus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_saurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Potapov Sergey
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-10-
|
16
|
+
date: 2019-10-26 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: pg
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- README.markdown
|
215
215
|
- bin/rails
|
216
216
|
- lib/colorized_text.rb
|
217
|
+
- lib/core_ext/active_record/connection_adapters/postgresql/column.rb
|
217
218
|
- lib/core_ext/active_record/connection_adapters/postgresql/schema_statements.rb
|
218
219
|
- lib/core_ext/active_record/errors.rb
|
219
220
|
- lib/core_ext/active_record/schema_dumper.rb
|