pg_power 1.6.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pg_power/connection_adapters/abstract_adapter.rb +1 -1
  3. data/lib/pg_power/connection_adapters/abstract_adapter/comment_methods.rb +2 -2
  4. data/lib/pg_power/connection_adapters/abstract_adapter/foreigner_methods.rb +1 -1
  5. data/lib/pg_power/connection_adapters/abstract_adapter/index_methods.rb +2 -2
  6. data/lib/pg_power/connection_adapters/abstract_adapter/schema_methods.rb +5 -5
  7. data/lib/pg_power/connection_adapters/postgresql_adapter.rb +5 -1
  8. data/lib/pg_power/connection_adapters/postgresql_adapter/foreigner_methods.rb +25 -19
  9. data/lib/pg_power/connection_adapters/postgresql_adapter/schema_methods.rb +22 -0
  10. data/lib/pg_power/connection_adapters/table.rb +2 -2
  11. data/lib/pg_power/connection_adapters/table/comment_methods.rb +7 -7
  12. data/lib/pg_power/connection_adapters/table/foreigner_methods.rb +2 -2
  13. data/lib/pg_power/create_index_concurrently.rb +7 -5
  14. data/lib/pg_power/migration/command_recorder.rb +1 -1
  15. data/lib/pg_power/migration/command_recorder/comment_methods.rb +1 -1
  16. data/lib/pg_power/migration/command_recorder/extension_methods.rb +2 -2
  17. data/lib/pg_power/migration/command_recorder/foreigner_methods.rb +1 -1
  18. data/lib/pg_power/migration/command_recorder/schema_methods.rb +1 -1
  19. data/lib/pg_power/migration/command_recorder/view_methods.rb +17 -10
  20. data/lib/pg_power/schema_dumper/comment_methods.rb +3 -3
  21. data/lib/pg_power/schema_dumper/extension_methods.rb +4 -3
  22. data/lib/pg_power/schema_dumper/foreigner_methods.rb +3 -4
  23. data/lib/pg_power/version.rb +1 -1
  24. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee953c1e68917550d4fa803015b4ab2fd79e73f0
4
- data.tar.gz: b3efba0477006b38d3318c34d221d1198204dbc3
3
+ metadata.gz: ba398c2e068fec17d58c4785188309ae33248b95
4
+ data.tar.gz: f4b9bd5557f8875600e8c33bdc40f41dfffa88bd
5
5
  SHA512:
6
- metadata.gz: 703f61e2dc0fc919eb692b6fb01a023ddb17e877e48a46edad5d9749520eb6dac3df1734e86e0bac4e163c80b84ebd16dd20d2201af3a83da4b9bdf2524b1c75
7
- data.tar.gz: e5ef8ff906eb405ae3b19bd62d93d7d27c8ef8879bc094c9237387ccb487629a1a38d710f71b0ae8598645312ec7fd3307e80707d02e3071341f9ccff2320eb9
6
+ metadata.gz: 329c679047292bfbec8ccf5f8303be6fb7da481e08fb1cc1537ac1c3d9e4216234eebd9915455cea8ee238bc3cb8912f65a9bfea20c915f90a93e1e4ab9fba17
7
+ data.tar.gz: 589bf58b9678b12788d684ccdf7d4749231a708b58f5f2567f028f360337d8901f6a791be076e42e91c6f8cc13f49b108a618430fcf4ea1217006cf8d88bdc05
@@ -1,4 +1,4 @@
1
- # Extends {ActiveRecord::ConnectionAdapters::AbstractAdapter} class.
1
+ # Extends ActiveRecord::ConnectionAdapters::AbstractAdapter class.
2
2
  module PgPower::ConnectionAdapters::AbstractAdapter
3
3
  extend ActiveSupport::Autoload
4
4
  extend ActiveSupport::Concern
@@ -1,4 +1,4 @@
1
- # Extends {ActiveRecord::ConnectionAdapters::AbstractAdapter} with
1
+ # Extends ActiveRecord::ConnectionAdapters::AbstractAdapter with
2
2
  # empty methods for comments feature.
3
3
  module PgPower::ConnectionAdapters::AbstractAdapter::CommentMethods
4
4
  def supports_comments?
@@ -57,7 +57,7 @@ module PgPower::ConnectionAdapters::AbstractAdapter::CommentMethods
57
57
  # ====== Removing comment from the npa column of table phone_numbers
58
58
  # remove_column_comment :phone_numbers, :npa
59
59
  def remove_column_comment(table_name, column_name)
60
-
60
+
61
61
  end
62
62
 
63
63
  # Removes any comment from the given columns of a given table.
@@ -1,4 +1,4 @@
1
- # Extends {ActiveRecord::ConnectionAdapters::AbstractAdapter} with
1
+ # Extends ActiveRecord::ConnectionAdapters::AbstractAdapter with
2
2
  # empty methods for foreign keys feature.
3
3
  module PgPower::ConnectionAdapters::AbstractAdapter::ForeignerMethods
4
4
  def supports_foreign_keys?
@@ -1,6 +1,6 @@
1
- # Extends {ActiveRecord::ConnectionAdapters::AbstractAdapter}
1
+ # Extends ActiveRecord::ConnectionAdapters::AbstractAdapter.
2
2
  module PgPower::ConnectionAdapters::AbstractAdapter::IndexMethods
3
3
  def supports_partial_index?
4
4
  false
5
5
  end
6
- end
6
+ end
@@ -1,18 +1,18 @@
1
- # Extends {ActiveRecord::ConnectionAdapters::AbstractAdapter}
2
- # with methods for multi schema support.
1
+ # Extends ActiveRecord::ConnectionAdapters::AbstractAdapter
2
+ # with methods for multi-schema support.
3
3
  module PgPower::ConnectionAdapters::AbstractAdapter::SchemaMethods
4
4
 
5
- # Provides :schema option to +create_table+ method.
5
+ # Provide :schema option to +create_table+ method.
6
6
  def create_table_with_schema_option(table_name, options = {}, &block)
7
7
  schema_name = options.delete(:schema)
8
8
  table_name = "#{schema_name}.#{table_name}" if schema_name
9
9
  create_table_without_schema_option(table_name, options, &block)
10
10
  end
11
11
 
12
- # Provides :schema option to +drop_table+ method.
12
+ # Provide :schema option to +drop_table+ method.
13
13
  def drop_table_with_schema_option(table_name, options = {})
14
14
  schema_name = options.delete(:schema)
15
15
  table_name = "#{schema_name}.#{table_name}" if schema_name
16
16
  drop_table_without_schema_option(table_name, options)
17
17
  end
18
- end
18
+ end
@@ -5,7 +5,7 @@ module PgPower::ConnectionAdapters::PostgreSQLAdapter
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  # TODO: Looks like explicit path specification can be omitted -- aignatyev 20120904
8
- autoload :ExtensionMethods, 'pg_power/connection_adapters/postgresql_adapter/extension_methods'
8
+ autoload :ExtensionMethods, 'pg_power/connection_adapters/postgresql_adapter/extension_methods'
9
9
  autoload :SchemaMethods, 'pg_power/connection_adapters/postgresql_adapter/schema_methods'
10
10
  autoload :CommentMethods, 'pg_power/connection_adapters/postgresql_adapter/comment_methods'
11
11
  autoload :ForeignerMethods, 'pg_power/connection_adapters/postgresql_adapter/foreigner_methods'
@@ -20,4 +20,8 @@ module PgPower::ConnectionAdapters::PostgreSQLAdapter
20
20
  include IndexMethods
21
21
  include TranslateException
22
22
  include ViewMethods
23
+
24
+ included do
25
+ alias_method_chain :tables, :non_public_schema_tables
26
+ end
23
27
  end
@@ -6,7 +6,7 @@ module PgPower # :nodoc:
6
6
  true
7
7
  end
8
8
 
9
- # Fetches information about foreign keys related to passed table.
9
+ # Fetch information about foreign keys related to the passed table.
10
10
  # @param [String, Symbol] table_name name of table (e.g. "users", "music.bands")
11
11
  # @return [Foreigner::ConnectionAdapters::ForeignKeyDefinition]
12
12
  def foreign_keys(table_name)
@@ -20,12 +20,12 @@ module PgPower # :nodoc:
20
20
  c.conname AS name ,
21
21
  c.confdeltype AS dependency
22
22
  FROM pg_constraint c
23
- JOIN pg_class t1 ON c.conrelid = t1.oid
24
- JOIN pg_class t2 ON c.confrelid = t2.oid
25
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
26
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
27
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
28
- JOIN pg_namespace nsp ON nsp.oid = t2.relnamespace
23
+ JOIN pg_class t1 ON c.conrelid = t1.oid
24
+ JOIN pg_class t2 ON c.confrelid = t2.oid
25
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
26
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
27
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
28
+ JOIN pg_namespace nsp ON nsp.oid = t2.relnamespace
29
29
  WHERE c.contype = 'f'
30
30
  AND t1.relname = '#{relation}'
31
31
  AND t3.nspname = #{quoted_schema}
@@ -45,9 +45,10 @@ module PgPower # :nodoc:
45
45
  end
46
46
  end
47
47
 
48
- # (optionally disable triggers) and drop table
49
- # changes adapted from https://github.com/matthuhiggins/foreigner/blob/e72ab9c454c156056d3f037d55e3359cd972af32/lib/foreigner/connection_adapters/sql2003.rb
50
- # NOTE: disabling referential integrity requires superuser access in postgres. Default AR behavior is to just drop_table.
48
+ # Drop table and optionally disable triggers.
49
+ # Changes adapted from https://github.com/matthuhiggins/foreigner/blob/e72ab9c454c156056d3f037d55e3359cd972af32/lib/foreigner/connection_adapters/sql2003.rb
50
+ # NOTE: Disabling referential integrity requires superuser access in postgres.
51
+ # Default AR behavior is just to drop_table.
51
52
  #
52
53
  # == Options:
53
54
  # * :force - force disabling of referential integrity
@@ -62,7 +63,7 @@ module PgPower # :nodoc:
62
63
  end
63
64
  end
64
65
 
65
- # Adds foreign key.
66
+ # Add foreign key.
66
67
  #
67
68
  # Ensures that an index is created for the foreign key, unless :exclude_index is true.
68
69
  #
@@ -113,7 +114,7 @@ module PgPower # :nodoc:
113
114
  end
114
115
  end
115
116
 
116
- # Returns chunk of SQL to add foreign key based on table names and options.
117
+ # Return the SQL code fragment to add the foreign key based on the table names and options.
117
118
  def add_foreign_key_sql(from_table, to_table, options = {})
118
119
  foreign_key_name = foreign_key_name(from_table, options[:column], options)
119
120
  primary_key = options[:primary_key] || "id"
@@ -133,7 +134,7 @@ module PgPower # :nodoc:
133
134
  # TODO Determine if we can refactor the method signature
134
135
  # remove_foreign_key(from_table, to_table_or_options_hash, options={}) => remove_foreign_key(from_table, to_table, options={})
135
136
  #
136
- # Removes foreign key.
137
+ # Remove the foreign key.
137
138
  # @param [String, Symbol] from_table
138
139
  # @param [String, Hash] to_table_or_options_hash
139
140
  #
@@ -162,17 +163,17 @@ module PgPower # :nodoc:
162
163
  remove_index(from_table, column) unless options[:exclude_index] || !index_exists?(from_table, column)
163
164
  end
164
165
 
165
- # Returns chunk of SQL to remove foreign key based on table name and options.
166
+ # Return the SQL code fragment to remove foreign key based on table name and options.
166
167
  def remove_foreign_key_sql(foreign_key_name)
167
168
  "DROP CONSTRAINT #{quote_column_name(foreign_key_name)}"
168
169
  end
169
170
 
170
- # Builds the foreign key column id from the referenced table
171
+ # Build the foreign key column id from the referenced table.
171
172
  def id_column_name_from_table_name(table)
172
173
  "#{table.to_s.split('.').last.singularize}_id"
173
174
  end
174
175
 
175
- # Extracts the foreign key column id from the foreign key metadata
176
+ # Extract the foreign key column id from the foreign key metadata.
176
177
  # @param [String, Symbol] from_table
177
178
  # @param [String] foreign_key_name
178
179
  def id_column_name_from_foreign_key_metadata(from_table, foreign_key_name)
@@ -182,7 +183,7 @@ module PgPower # :nodoc:
182
183
  end
183
184
  private :id_column_name_from_foreign_key_metadata
184
185
 
185
- # Builds default name for constraint
186
+ # Build default name for constraint.
186
187
  def foreign_key_name(table, column, options = {})
187
188
  if options[:name]
188
189
  options[:name]
@@ -193,10 +194,15 @@ module PgPower # :nodoc:
193
194
  end
194
195
  private :foreign_key_name
195
196
 
197
+ # Get the SQL code fragment that represents dependency for a constraint.
198
+ #
199
+ # @param dependency [Symbol] :nullify, :delete or :restrict
200
+ #
201
+ # @return [String]
196
202
  def dependency_sql(dependency)
197
203
  case dependency
198
- when :nullify then "ON DELETE SET NULL"
199
- when :delete then "ON DELETE CASCADE"
204
+ when :nullify then "ON DELETE SET NULL"
205
+ when :delete then "ON DELETE CASCADE"
200
206
  when :restrict then "ON DELETE RESTRICT"
201
207
  else ""
202
208
  end
@@ -19,4 +19,26 @@ module PgPower::ConnectionAdapters::PostgreSQLAdapter::SchemaMethods
19
19
  def move_table_to_schema(table, schema)
20
20
  ::PgPower::Tools.move_table_to_schema(table, schema)
21
21
  end
22
+
23
+ # Make method +tables+ return tables not only from public schema.
24
+ #
25
+ # @note
26
+ # Tables from public schema have no "public." prefix. It's done for
27
+ # compatibility with other libraries that relies on a table name.
28
+ # Tables from other schemas has appropriate prefix with schema name.
29
+ # See: https://github.com/TMXCredit/pg_power/pull/42
30
+ #
31
+ # @return [Array<String>] table names
32
+ def tables_with_non_public_schema_tables(*args)
33
+ public_tables = tables_without_non_public_schema_tables(*args)
34
+
35
+ non_public_tables =
36
+ query(<<-SQL, 'SCHEMA').map { |row| row[0] }
37
+ SELECT schemaname || '.' || tablename AS table
38
+ FROM pg_tables
39
+ WHERE schemaname NOT IN ('pg_catalog', 'information_schema', 'public')
40
+ SQL
41
+
42
+ public_tables + non_public_tables
43
+ end
22
44
  end
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::ConnectionAdapters::Table}
1
+ # Provides methods to extend ActiveRecord::ConnectionAdapters::Table
2
2
  # to support pg_power features.
3
3
  module PgPower::ConnectionAdapters::Table
4
4
  extend ActiveSupport::Autoload
@@ -10,7 +10,7 @@ module PgPower::ConnectionAdapters::Table
10
10
  include CommentMethods
11
11
  include ForeignerMethods
12
12
 
13
-
13
+
14
14
  included do
15
15
  alias_method_chain :references, :foreign_keys
16
16
  end
@@ -1,7 +1,7 @@
1
- # Provides methods to extend {ActiveRecord::ConnectionAdapters::Table}
1
+ # Provides methods to extend ActiveRecord::ConnectionAdapters::Table
2
2
  # to support comments feature.
3
3
  module PgPower::ConnectionAdapters::Table::CommentMethods
4
- # Sets the comment on the table
4
+ # Set the comment on the table.
5
5
  #
6
6
  # ===== Example
7
7
  # ====== Set comment on table
@@ -10,7 +10,7 @@ module PgPower::ConnectionAdapters::Table::CommentMethods
10
10
  @base.set_table_comment(@table_name, comment)
11
11
  end
12
12
 
13
- # Removes any comment from the table
13
+ # Remove any comment from the table.
14
14
  #
15
15
  # ===== Example
16
16
  # ====== Remove table comment
@@ -19,7 +19,7 @@ module PgPower::ConnectionAdapters::Table::CommentMethods
19
19
  @base.remove_table_comment(@table_name)
20
20
  end
21
21
 
22
- # Sets the comment for a given column
22
+ # Set the comment for a given column.
23
23
  #
24
24
  # ===== Example
25
25
  # ====== Set comment on the npa column
@@ -28,7 +28,7 @@ module PgPower::ConnectionAdapters::Table::CommentMethods
28
28
  @base.set_column_comment(@table_name, column_name, comment)
29
29
  end
30
30
 
31
- # Sets comments on multiple columns. 'comments' is a hash of column_name => comment pairs.
31
+ # Set comments on multiple columns. 'comments' is a hash of column_name => comment pairs.
32
32
  #
33
33
  # ===== Example
34
34
  # ====== Setting comments on the columns of the phone_numbers table
@@ -38,7 +38,7 @@ module PgPower::ConnectionAdapters::Table::CommentMethods
38
38
  @base.set_column_comments(@table_name, comments)
39
39
  end
40
40
 
41
- # Removes any comment for a given column
41
+ # Remove any comment for a given column.
42
42
  #
43
43
  # ===== Example
44
44
  # ====== Remove comment from the npa column
@@ -47,7 +47,7 @@ module PgPower::ConnectionAdapters::Table::CommentMethods
47
47
  @base.remove_column_comment(@table_name, column_name)
48
48
  end
49
49
 
50
- # Removes any comments from the given columns
50
+ # Remove any comments from the given columns.
51
51
  #
52
52
  # ===== Example
53
53
  # ====== Remove comment from the npa and nxx columns
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::ConnectionAdapters::Table}
1
+ # Provides methods to extend ActiveRecord::ConnectionAdapters::Table
2
2
  # to support foreign keys feature.
3
3
  module PgPower::ConnectionAdapters::Table::ForeignerMethods
4
4
  # Adds a new foreign key to the table. +to_table+ can be a single Symbol, or
@@ -40,7 +40,7 @@ module PgPower::ConnectionAdapters::Table::ForeignerMethods
40
40
  def references_with_foreign_keys(*args)
41
41
  options = args.extract_options!
42
42
 
43
- if fk_options = options.delete(:foreign_key)
43
+ if options.delete(:foreign_key)
44
44
  p ActiveSupport::Deprecation.send(:deprecation_message, caller,
45
45
  ":foreign_key in t.references is deprecated. " \
46
46
  "Use t.foreign_key instead")
@@ -56,7 +56,7 @@ module PgPower::CreateIndexConcurrently
56
56
  private :postponed_queries, :postponed_queries=
57
57
 
58
58
 
59
- # Adds a new index to the table. +column_name+ can be a single Symbol, or
59
+ # Add a new index to the table. +column_name+ can be a single Symbol, or
60
60
  # an Array of Symbols.
61
61
  #
62
62
  # @param [Symbol, String] table_name
@@ -86,7 +86,7 @@ module PgPower::CreateIndexConcurrently
86
86
  nil
87
87
  end
88
88
 
89
- # Adds foreign key.
89
+ # Add a foreign key.
90
90
  #
91
91
  # == Options:
92
92
  # * :column
@@ -140,7 +140,7 @@ module PgPower::CreateIndexConcurrently
140
140
  self
141
141
  end
142
142
 
143
- # Clean postponed queries' queue.
143
+ # Clean postponed queries queue.
144
144
  #
145
145
  # @return [::PgPower::CreateIndexConcurrently::Migration] migration
146
146
  def clear_queue
@@ -165,19 +165,20 @@ module PgPower::CreateIndexConcurrently
165
165
  private :enque
166
166
  end
167
167
 
168
- # Allows to call `process_postponed_queries` on MigrationProxy instances.
168
+ # Allows `process_postponed_queries` to be called on MigrationProxy instances.
169
169
  # So, (see ::PgPower::CreateIndexConcurrently::Migrator) could run index
170
170
  # creation concurrently.
171
171
  #
172
172
  # Default delegation in (see ActiveRecord::MigrationProxy) allows to call
173
173
  # only several methods.
174
174
  module MigrationProxy
175
+ # :nodoc:
175
176
  def self.included(klass)
176
177
  klass.delegate :process_postponed_queries, :to => :migration
177
178
  end
178
179
  end
179
180
 
180
- # Runs posponed index creation for each migration.
181
+ # Run postponed index creation for each migration.
181
182
  #
182
183
  # This module included into (see ::ActiveRecord::Migrator) class to make possible
183
184
  # to execute queries for postponed index creation after closing migration's
@@ -188,6 +189,7 @@ module PgPower::CreateIndexConcurrently
188
189
  module Migrator
189
190
  extend ActiveSupport::Concern
190
191
 
192
+ # :nodoc:
191
193
  def self.included(klass)
192
194
  klass.alias_method_chain :ddl_transaction, :postponed_queries
193
195
  end
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support pg_power features.
3
3
  module PgPower::Migration::CommandRecorder
4
4
  extend ActiveSupport::Autoload
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support comments feature.
3
3
  module PgPower::Migration::CommandRecorder::CommentMethods
4
4
  # :nodoc:
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support extensions feature.
3
3
  module PgPower::Migration::CommandRecorder::ExtensionMethods
4
4
  # :nodoc:
@@ -22,4 +22,4 @@ module PgPower::Migration::CommandRecorder::ExtensionMethods
22
22
  extension_name = args.first
23
23
  [:create_extension, [extension_name]]
24
24
  end
25
- end
25
+ end
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support foreign keys feature.
3
3
  module PgPower::Migration::CommandRecorder::ForeignerMethods
4
4
  # :nodoc:
@@ -1,4 +1,4 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support multi schemas feature.
3
3
  module PgPower::Migration::CommandRecorder::SchemaMethods
4
4
  # :nodoc:
@@ -1,24 +1,31 @@
1
- # Provides methods to extend {ActiveRecord::Migration::CommandRecorder} to
1
+ # Provides methods to extend ActiveRecord::Migration::CommandRecorder to
2
2
  # support view feature.
3
3
  module PgPower::Migration::CommandRecorder::ViewMethods
4
-
5
- # Creates PostgreSQL view
6
- # @param [String, Symbol] view_name
7
- # @param [String] view_definition
4
+ # Create a PostgreSQL view.
5
+ #
6
+ # @param args [Array] view_name and view_definition
7
+ #
8
+ # @return [view]
8
9
  def create_view(*args)
9
10
  record(:create_view, args)
10
11
  end
11
12
 
12
- # Drops view in DB.
13
- # @param [String, Symbol] view_name
13
+ # Drop a view in the DB.
14
+ #
15
+ # @param args [Array] first argument is view_name
16
+ #
17
+ # @return [void]
14
18
  def drop_view(*args)
15
19
  record(:drop_view, args)
16
20
  end
17
21
 
18
- # Inverts creation of a view in DB.
19
- # @param [String, Symbol] view_name
22
+ # Invert the creation of a view in the DB.
23
+ #
24
+ # @param args [Array] first argument is supposed to be name of view
25
+ #
26
+ # @return [void]
20
27
  def invert_create_view(args)
21
28
  [:drop_view, [args.first]]
22
29
  end
23
-
30
+
24
31
  end
@@ -1,6 +1,6 @@
1
1
  # Extends ActiveRecord::SchemaDumper class to dump comments on tables and columns.
2
2
  module PgPower::SchemaDumper::CommentMethods
3
- # Hooks {ActiveRecord::SchemaDumper#table} method to dump comments on
3
+ # Hook ActiveRecord::SchemaDumper#table method to dump comments on
4
4
  # table and columns.
5
5
  def tables_with_comments(stream)
6
6
  tables_without_comments(stream)
@@ -25,7 +25,7 @@ module PgPower::SchemaDumper::CommentMethods
25
25
  end
26
26
  end
27
27
 
28
- # Finds all comments related to passed table and writes appropriated
28
+ # Find all comments related to passed table and write appropriate
29
29
  # statements to stream.
30
30
  def dump_comments(table_name, stream)
31
31
  unless (comments = @connection.comments(table_name)).empty?
@@ -46,7 +46,7 @@ module PgPower::SchemaDumper::CommentMethods
46
46
  end
47
47
  private :dump_comments
48
48
 
49
- # Escape out single quotes from comments
49
+ # Escape single quotes from comments.
50
50
  def format_comment(comment)
51
51
  comment.gsub(/'/, "\\\\'")
52
52
  end
@@ -1,13 +1,14 @@
1
1
  # Extends ActiveRecord::SchemaDumper class to dump comments on tables and columns.
2
2
  module PgPower::SchemaDumper::ExtensionMethods
3
- # Hooks {ActiveRecord::SchemaDumper#header} method to dump extensions in all schemas except for pg_catalog
3
+ # Hook ActiveRecord::SchemaDumper#header method to dump extensions in all
4
+ # schemas except for pg_catalog.
4
5
  def header_with_extensions(stream)
5
6
  header_without_extensions(stream)
6
7
  dump_extensions(stream)
7
8
  stream
8
9
  end
9
10
 
10
- # Dump current database extensions recreation commands to the given stream
11
+ # Dump current database extensions recreation commands to the given stream.
11
12
  #
12
13
  # @param [#puts] stream Stream to write to
13
14
  def dump_extensions(stream)
@@ -25,4 +26,4 @@ module PgPower::SchemaDumper::ExtensionMethods
25
26
 
26
27
  stream.puts
27
28
  end
28
- end
29
+ end
@@ -1,12 +1,11 @@
1
- # Provides methods to extend {ActiveRecord::SchemaDumper} to dump
1
+ # Provides methods to extend ActiveRecord::SchemaDumper to dump
2
2
  # foreign keys.
3
3
  module PgPower::SchemaDumper::ForeignerMethods
4
- # Hooks {ActiveRecord::SchemaDumper#table} method to dump foreign keys.
4
+ # Hooks ActiveRecord::SchemaDumper#table method to dump foreign keys.
5
5
  def tables_with_foreign_keys(stream)
6
6
  tables_without_foreign_keys(stream)
7
7
 
8
8
  table_names = @connection.tables.sort
9
- table_names += get_non_public_schema_table_names.sort
10
9
 
11
10
  table_names.sort.each do |table|
12
11
  next if ['schema_migrations', ignore_tables].flatten.any? do |ignored|
@@ -22,7 +21,7 @@ module PgPower::SchemaDumper::ForeignerMethods
22
21
  end
23
22
 
24
23
 
25
- # Finds all foreign keys on passed table and writes appropriated
24
+ # Find all foreign keys on passed table and writes appropriate
26
25
  # statements to stream.
27
26
  def foreign_keys(table_name, stream)
28
27
  if (foreign_keys = @connection.foreign_keys(table_name)).any?
@@ -1,4 +1,4 @@
1
1
  module PgPower
2
2
  # Version of pg_power gem.
3
- VERSION = '1.6.3'
3
+ VERSION = '1.6.4'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_power
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Potapov Sergey
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-01-10 00:00:00.000000000 Z
15
+ date: 2014-01-16 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pg
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.0.3
178
+ rubygems_version: 2.1.11
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: ActiveRecord extensions for PostgreSQL.