repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/constraint.rb
lib/pg_trunk/operations/domains/constraint.rb
# frozen_string_literal: false module PGTrunk::Operations::Domains # @private # Definition for the domain's constraint class Constraint include ActiveModel::Model include ActiveModel::Attributes include ActiveModel::Validations def self.build(data) data.is_a?(self) ? data : new(**data) ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/change_domain.rb
lib/pg_trunk/operations/domains/change_domain.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify a domain type # # # # @param [#to_s] name (nil) The qualified name of the type # # @yield [d] the block with the type's definition # # @yieldparam Object receiver of methods specifying the type # # @return [vo...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/base.rb
lib/pg_trunk/operations/domains/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Domains # @abstract # @private # Base class for operations with domain types class Base < PGTrunk::Operation # All attributes that can be used by domain-related commands attribute :collation, :pg_trunk_qualified_name attribute :constraints,...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/drop_domain.rb
lib/pg_trunk/operations/domains/drop_domain.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a domain type by qualified name # # # # @param [#to_s] name (nil) The qualified name of the type # # @option options [Boolean] :if_exists (false) Suppress the error when the type is absent # # @option options [Symbo...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/domains/rename_domain.rb
lib/pg_trunk/operations/domains/rename_domain.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a domain type # # # # @param [#to_s] :name (nil) The qualified name of the type # # @option options [#to_s] :to (nil) The new qualified name for the type # # @return [void] # # # ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views/create_view.rb
lib/pg_trunk/operations/views/create_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create a view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :replace_existing (false) If the view should overwrite an existing one # # @option options [#to_s] :sql_definit...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views/drop_view.rb
lib/pg_trunk/operations/views/drop_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :replace_existing (false) If the view should overwrite an existing one # # @option options [Boolean] :if_exists (...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views/base.rb
lib/pg_trunk/operations/views/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Views # @abstract # @private # Base class for operations with views class Base < PGTrunk::Operation # All attributes that can be used by view-related commands attribute :check, :pg_trunk_symbol attribute :force, :pg_trunk_symbol attribu...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views/change_view.rb
lib/pg_trunk/operations/views/change_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify a view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :if_exists (false) Suppress the error when the view is absent # # @yield [v] the block with the view's definiti...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/views/rename_view.rb
lib/pg_trunk/operations/views/rename_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a view # # # # @param [#to_s] :name (nil) The qualified name of the view # # @option options [#to_s] :to (nil) The new qualified name for the view # # @option options [Boolean] :if_exists...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/create_materialized_view.rb
lib/pg_trunk/operations/materialized_views/create_materialized_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create a materialized view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :if_not_exists (false) Suppress the error when a view has been already created # # @option options...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/change_materialized_view.rb
lib/pg_trunk/operations/materialized_views/change_materialized_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify a materialized view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :if_exists (false) Suppress the error when the view is absent # # @yield [v] the block with the vi...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb
lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a materialized view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :if_exists (false) Suppress the error when the view is absent # # @option options [Symbol] :force (:...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/base.rb
lib/pg_trunk/operations/materialized_views/base.rb
# frozen_string_literal: false module PGTrunk::Operations::MaterializedViews # @abstract # @private # Base class for operations with views class Base < PGTrunk::Operation # All attributes that can be used by view-related commands attribute :algorithm, :pg_trunk_symbol attribute :cluster_on, :string...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/rename_materialized_view.rb
lib/pg_trunk/operations/materialized_views/rename_materialized_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a materialized view # # # # @param [#to_s] :name (nil) The qualified name of the view # # @option options [#to_s] :to (nil) The new qualified name for the view # # @option options [Boolea...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/refresh_materialized_view.rb
lib/pg_trunk/operations/materialized_views/refresh_materialized_view.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Refresh a materialized view # # # # @param [#to_s] name (nil) The qualified name of the view # # @option options [Boolean] :with_data (true) If the view should be populated after creation # # @option options [Symbol] :al...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/materialized_views/column.rb
lib/pg_trunk/operations/materialized_views/column.rb
# frozen_string_literal: true module PGTrunk::Operations::MaterializedViews # @private # Definition for the column change class Column include ActiveModel::Model include ActiveModel::Attributes include ActiveModel::Validations def self.build(data) data.is_a?(self) ? data : new(**data) ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/tables/create_table.rb
lib/pg_trunk/operations/tables/create_table.rb
# frozen_string_literal: true module PGTrunk::Operations::Tables # @private # # When dealing with tables we're only interested in # dumping tables one-by-one to enable other operations # in between tables. # # We doesn't overload the method `create_table`, but # keep the original implementation unchang...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions/rename_function.rb
lib/pg_trunk/operations/functions/rename_function.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a function # # # # @param [#to_s] :name (nil) The qualified name of the function # # @option options [#to_s] :to (nil) The new qualified name for the function # # @return [void] # # #...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions/create_function.rb
lib/pg_trunk/operations/functions/create_function.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create a function # # # # @param [#to_s] name (nil) # # The qualified name of the function with arguments and returned value type # # @option options [Boolean] :replace_existing (false) If the function should overwrite...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions/change_function.rb
lib/pg_trunk/operations/functions/change_function.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify a function # # # # @param [#to_s] name (nil) The qualified name of the function # # @option options [Boolean] :if_exists (false) Suppress the error when the function is absent # # @yield [f] the block with the fun...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions/base.rb
lib/pg_trunk/operations/functions/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Functions # @abstract # @private # Base class for operations with functions class Base < PGTrunk::Operation # All attributes that can be used by function-related commands attribute :body, :pg_trunk_multiline_text attribute :cost, :float ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/functions/drop_function.rb
lib/pg_trunk/operations/functions/drop_function.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a function # # # # @param [#to_s] name (nil) # # The qualified name of the function with arguments and returned value type # # @option options [Boolean] :if_exists (false) Suppress the error when the function is a...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb
lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Rename a check constraint # # # # @param [#to_s] table (nil) The qualified name of the table # # @param [#to_s] expression (nil) The SQL expression # # @option options [#to_s] :name (nil) The current name of the constrai...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb
lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Remove a check constraint from the table # # # # @param [#to_s] table (nil) The qualified name of the table # # @param [#to_s] expression (nil) The SQL expression # # @option options [Boolean] :if_exists (false) Suppress...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints/base.rb
lib/pg_trunk/operations/check_constraints/base.rb
# frozen_string_literal: false module PGTrunk::Operations::CheckConstraints # @abstract # @private # Base class for operations with check constraints class Base < PGTrunk::Operation # All attributes that can be used by check-related commands attribute :expression, :string attribute :inherit, :boole...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints/validate_check_constraint.rb
lib/pg_trunk/operations/check_constraints/validate_check_constraint.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Validate an invalid check constraint # # # # @param [#to_s] table (nil) The qualified name of the table # # @param [#to_s] expression (nil) The SQL expression # # @option options [#to_s] :name (nil) The optional name of ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/check_constraints/add_check_constraint.rb
lib/pg_trunk/operations/check_constraints/add_check_constraint.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Add a check constraint to the table # # # # @param [#to_s] table (nil) The qualified name of the table # # @param [#to_s] expression (nil) The SQL expression # # @option options [#to_s] :name (nil) The optional name of t...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/statistics/rename_statistics.rb
lib/pg_trunk/operations/statistics/rename_statistics.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a statistics # # # # @param [#to_s] :name (nil) The qualified name of the statistics # # @option options [#to_s] :to (nil) The new qualified name for the statistics # # @return [void] # ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/statistics/create_statistics.rb
lib/pg_trunk/operations/statistics/create_statistics.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create a custom statistics # # # # @param [#to_s] name (nil) The qualified name of the statistics # # @option options [Boolean] :if_not_exists (false) # # Suppress the error when the statistics is already exist # #...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/statistics/base.rb
lib/pg_trunk/operations/statistics/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Statistics # @abstract # @private # Base class for operations with check constraints class Base < PGTrunk::Operation # All attributes that can be used by statistics-related commands attribute :columns, :pg_trunk_array_of_strings, default: [] ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/statistics/drop_statistics.rb
lib/pg_trunk/operations/statistics/drop_statistics.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a custom statistics # # # # @param [#to_s] name (nil) The qualified name of the statistics # # @option options [Boolean] :if_exists (false) Suppress the error when the statistics is absent # # @option options [Symbo...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/indexes/add_index.rb
lib/pg_trunk/operations/indexes/add_index.rb
# frozen_string_literal: true module PGTrunk::Operations::Indexes # @private # # PGTrunk excludes indexes from table definitions provided by Rails. # That's why we have to fetch and dump indexes separately. # # We fetch indexes from the database by their names and oids, # and then rely on the original me...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures/rename_procedure.rb
lib/pg_trunk/operations/procedures/rename_procedure.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of a procedure # # # # @param [#to_s] :name (nil) The qualified name of the procedure # # @option options [#to_s] :to (nil) The new qualified name for the procedure # # @return [void] # ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures/base.rb
lib/pg_trunk/operations/procedures/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Procedures # @abstract # @private # Base class for operations with procedures class Base < PGTrunk::Operation # All attributes that can be used by procedure-related commands attribute :body, :pg_trunk_multiline_text attribute :language, :pg...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures/create_procedure.rb
lib/pg_trunk/operations/procedures/create_procedure.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create a procedure # # # # @param [#to_s] name (nil) # # The qualified name of the procedure with arguments and returned value type # # @option options [Boolean] :replace_existing (false) If the procedure should overwr...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures/change_procedure.rb
lib/pg_trunk/operations/procedures/change_procedure.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify a procedure # # # # @param [#to_s] name (nil) The qualified name of the procedure # # @option options [Boolean] :if_exists (false) Suppress the error when the procedure is absent # # @yield [p] the block with the ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/procedures/drop_procedure.rb
lib/pg_trunk/operations/procedures/drop_procedure.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop a procedure # # # # @param [#to_s] name (nil) # # The qualified name of the procedure with arguments and returned value type # # @option options [Boolean] :if_exists (false) Suppress the error when the procedure i...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/drop_enum.rb
lib/pg_trunk/operations/enums/drop_enum.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Drop an enumerated type by qualified name # # # # @param [#to_s] name (nil) The qualified name of the type # # @option options [Boolean] :if_exists (false) Suppress the error when the type is absent # # @option options [...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/change.rb
lib/pg_trunk/operations/enums/change.rb
# frozen_string_literal: false module PGTrunk::Operations::Enums # @private # Definition for the value's change class Change include ActiveModel::Model include ActiveModel::Attributes include ActiveModel::Validations def self.build(data) data.is_a?(self) ? data : new(**data) end a...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/rename_enum.rb
lib/pg_trunk/operations/enums/rename_enum.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Change the name and/or schema of an enumerated type # # # # @param [#to_s] :name (nil) The qualified name of the type # # @option options [#to_s] :to (nil) The new qualified name for the type # # @return [void] # # #...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/base.rb
lib/pg_trunk/operations/enums/base.rb
# frozen_string_literal: false module PGTrunk::Operations::Enums # @abstract # @private # Base class for operations with enumerated types class Base < PGTrunk::Operation # All attributes that can be used by enum-related commands attribute :changes, :pg_trunk_array_of_hashes, default: [] attribute :...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/create_enum.rb
lib/pg_trunk/operations/enums/create_enum.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Create an enumerated type by qualified name # # # # @param [#to_s] name (nil) The qualified name of the type # # @option options [Array<#to_s>] :values ([]) The list of values # # @option options [#to_s] :comment (nil) T...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/operations/enums/change_enum.rb
lib/pg_trunk/operations/enums/change_enum.rb
# frozen_string_literal: false # @!parse # class ActiveRecord::Migration # # Modify an enumerated type # # # # @param [#to_s] name (nil) The qualified name of the type # # @yield [e] the block with the type's definition # # @yieldparam Object receiver of methods specifying the type # # @retur...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/qualified_name.rb
lib/pg_trunk/core/qualified_name.rb
# frozen_string_literal: true module PGTrunk # @private # The qualified name of an object consists from schema (namespace) and name. # The class contains several helper methods for ruby and sql snippets. QualifiedName = Struct.new(:schema, :name) do include Comparable # Build qualified name structure ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/generators.rb
lib/pg_trunk/core/generators.rb
# frozen_string_literal: false require "rails/generators" require "rails/generators/active_record" # @private # @abstract # Module to build object-specific generators module PGTrunk::Generators extend ActiveSupport::Concern class << self # Add new generator for given operation # @param [Class < PGTrunk::...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/registry.rb
lib/pg_trunk/core/registry.rb
# frozen_string_literal: true module PGTrunk # @private # The internal model to represent the gem-specific registry # where we store information about objects added by migrations. # # Every time when an object is created, we should record it # in the table, setting its `oid` along with the reference # to...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie.rb
lib/pg_trunk/core/railtie.rb
# frozen_string_literal: true # nodoc module PGTrunk # @private # Turn in PGTrunk-relates stuff in the Rails app class Railtie < Rails::Railtie require_relative "railtie/command_recorder" require_relative "railtie/custom_types" require_relative "railtie/migration" require_relative "railtie/migrat...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation.rb
lib/pg_trunk/core/operation.rb
# frozen_string_literal: false require_relative "operation/callbacks" require_relative "operation/attributes" require_relative "operation/generators" require_relative "operation/validations" require_relative "operation/inversion" require_relative "operation/ruby_builder" require_relative "operation/ruby_helpers" requi...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers.rb
lib/pg_trunk/core/serializers.rb
# frozen_string_literal: true module PGTrunk # @private # Namespace for the gem-specific activemodel serializers module Serializers require_relative "serializers/array_serializer" require_relative "serializers/array_of_hashes_serializer" require_relative "serializers/array_of_strings_serializer" ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/validators.rb
lib/pg_trunk/core/validators.rb
# frozen_string_literal: true module PGTrunk # @private # Namespace for the gem-specific activemodel validators module Validators require_relative "validators/all_items_valid_validator" require_relative "validators/difference_validator" end end
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/dependencies_resolver.rb
lib/pg_trunk/core/dependencies_resolver.rb
# frozen_string_literal: true module PGTrunk # @private # Resolve dependencies between inter-dependent objects, # identified by database `#oid` and comparable to each other. # # The method builds the sorted list: # - parent objects moved before their dependants. # - independent objects keeps their origin...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/multiline_text_serializer.rb
lib/pg_trunk/core/serializers/multiline_text_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as a multiline text # with right-stripped lines and without empty lines. class MultilineTextSerializer < ActiveRecord::Type::Value def cast(value) return if value.blank? value.to_s.lines....
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/lowercase_string_serializer.rb
lib/pg_trunk/core/serializers/lowercase_string_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as a non-empty stripped string in lowercase class LowercaseStringSerializer < ActiveRecord::Type::Value def cast(value) value.to_s.presence&.downcase&.strip end def serialize(value) ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/array_of_strings_serializer.rb
lib/pg_trunk/core/serializers/array_of_strings_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as an array of strings. # It knows how to cast arrays returned by PostgreSQL # as a string like '{USD,EUR,GBP}' into ['USD', 'EUR', 'GBP']. class ArrayOfStringsSerializer < ActiveRecord::Type::Value ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/symbol_serializer.rb
lib/pg_trunk/core/serializers/symbol_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as a symbol. class SymbolSerializer < ActiveRecord::Type::Value def cast(value) return if value.blank? return value if value.is_a?(Symbol) return value.to_sym if value.respond_to?(:to_...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/array_serializer.rb
lib/pg_trunk/core/serializers/array_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as an array, not caring about its content. class ArraySerializer < ActiveRecord::Type::Value def cast(value) case value when ::NilClass then [] when ::Array then value else [valu...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/qualified_name_serializer.rb
lib/pg_trunk/core/serializers/qualified_name_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as a qualified name. class QualifiedNameSerializer < ActiveRecord::Type::Value TYPE = ::PGTrunk::QualifiedName def cast(value) case value when NilClass then nil when TYPE then val...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/array_of_symbols_serializer.rb
lib/pg_trunk/core/serializers/array_of_symbols_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # The same as the array of strings with symbolization at the end class ArrayOfSymbolsSerializer < ActiveRecord::Type::Value def cast(value) case value when ::NilClass then [] when ::Symbol then [value] whe...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/serializers/array_of_hashes_serializer.rb
lib/pg_trunk/core/serializers/array_of_hashes_serializer.rb
# frozen_string_literal: true # @private module PGTrunk::Serializers # @private # Cast the attribute value as an array of strings. # It knows how to cast arrays returned by PostgreSQL # as a string like '{USD,EUR,GBP}' into ['USD', 'EUR', 'GBP']. class ArrayOfHashesSerializer < ActiveRecord::Type::Value ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/custom_types.rb
lib/pg_trunk/core/railtie/custom_types.rb
# frozen_string_literal: true module PGTrunk # @private # The module adds custom type casting module CustomTypes # All custom types are typecasted to strings in Rails TYPE = ActiveRecord::ConnectionAdapters::PostgreSQL::OID::SpecializedString def self.known @known ||= Set.new([]) end ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/schema_dumper.rb
lib/pg_trunk/core/railtie/schema_dumper.rb
# frozen_string_literal: true module PGTrunk # @private # Overloads methods defined in ActiveRecord::SchemaDumper # to redefine how various objects must be dumped. module SchemaDumper class << self def operations @operations ||= [] end def register(operation) operations <...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/schema_migration.rb
lib/pg_trunk/core/railtie/schema_migration.rb
# frozen_string_literal: true module PGTrunk # @private # The module makes `pg_trunk` gem-specific registry # to be created and dropped along with the native schema. module SchemaMigration extend ActiveSupport::Concern class_methods do def create_table super PGTrunk::Registry.cre...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/statements.rb
lib/pg_trunk/core/railtie/statements.rb
# frozen_string_literal: true module PGTrunk # @private # The module adds commands to execute DDL operations in PostgreSQL. module Statements # @param [PGTrunk::Operation] klass def self.register(klass) define_method(klass.ruby_name) do |*args, &block| operation = klass.from_ruby(*args, &bl...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/migration.rb
lib/pg_trunk/core/railtie/migration.rb
# frozen_string_literal: true module PGTrunk # @private # The module goes around the ActiveRecord::Migration's `method_missing`. # # This is necessary because +ActiveRecord::Migration#method_missing+ # forces the first argument to be a proper table name. # # In Rails migrations the first argument specifi...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/command_recorder.rb
lib/pg_trunk/core/railtie/command_recorder.rb
# frozen_string_literal: true module PGTrunk # @private # The module record commands done during a migration. module CommandRecorder # @param [PGTrunk::Operation] klass def self.register(klass) define_method(klass.ruby_name) do |*args, &block| record(klass.ruby_name, args, &block) end...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/railtie/migrator.rb
lib/pg_trunk/core/railtie/migrator.rb
# frozen_string_literal: true module PGTrunk # @private # This module extends the ActiveRecord::Migrator # to clean the gem-specific registry `pg_trunk`: # # - set version to rows added by the current migration # - delete rows that refer to objects deleted by the migration # # We need this because some...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/validators/all_items_valid_validator.rb
lib/pg_trunk/core/validators/all_items_valid_validator.rb
# frozen_string_literal: true # @private # Ensure that all items in the array are valid class PGTrunk::AllItemsValidValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) Array.wrap(value).each.with_index.map do |item, index| item.errors.messages.each do |name, list| lis...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/validators/difference_validator.rb
lib/pg_trunk/core/validators/difference_validator.rb
# frozen_string_literal: true # @private # Ensure that an attribute is different from another one class PGTrunk::DifferenceValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) another_name = options.fetch(:from) another_value = record.send(another_name).presence case anothe...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/attributes.rb
lib/pg_trunk/core/operation/attributes.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Define getters/setters for the operation attributes module Attributes extend ActiveSupport::Concern include ActiveModel::Model include ActiveModel::Attributes # The special undefined value for getters/setters # to distinct i...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/inversion.rb
lib/pg_trunk/core/operation/inversion.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # The exception to be thrown when reversed migration isn't valid class IrreversibleMigration < ActiveRecord::IrreversibleMigration private def initialize(operation, inversion, *messages) msg = "#{header(operation)}#{inverted(inversi...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/generators.rb
lib/pg_trunk/core/operation/generators.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Register attributes definition for later usage by generators module Generators extend ActiveSupport::Concern class_methods do # Gets or sets object name for the generator def generates_object(name = nil) @generates_o...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/callbacks.rb
lib/pg_trunk/core/operation/callbacks.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Enable to fulfill/generate missed attributes # using the `after_initialize` callback. # # The callback is invoked after the end of the normal # initialization and applying a block with explicit settings. module Callbacks extend Activ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/validations.rb
lib/pg_trunk/core/operation/validations.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Enable validation of the operation in the Rails way module Validations extend ActiveSupport::Concern class_methods do extend ActiveModel::Validations end def error_messages errors.messages.flat_map do |k, v| ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/sql_helpers.rb
lib/pg_trunk/core/operation/sql_helpers.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Add helpers for building SQL queries module SQLHelpers extend ActiveSupport::Concern class_methods do include Enumerable # Get/set the block to extract operation definitions # from the database. # @yield [Proc] ...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/registration.rb
lib/pg_trunk/core/operation/registration.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Invoke all the necessary definitions # in the modules included to Rails via Railtie module Registration extend ActiveSupport::Concern class_methods do def from_sql(&block) super.tap { register_dumper if block } end...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/ruby_builder.rb
lib/pg_trunk/core/operation/ruby_builder.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Build ruby snippet class RubyBuilder private def initialize(name, shortage: nil) @args = [] @lines = [] @name = name&.to_s @opts = [] @shortage = shortage end # Add parameters to the method call def...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/operation/ruby_helpers.rb
lib/pg_trunk/core/operation/ruby_helpers.rb
# frozen_string_literal: true class PGTrunk::Operation # @private # Helpers to build ruby snippet from the operation definition module RubyHelpers extend ActiveSupport::Concern class_methods do # The name of the builder # @return [Symbol] def ruby_name @ruby_name ||= name.split...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
nepalez/pg_trunk
https://github.com/nepalez/pg_trunk/blob/d8d55e53121d01885da55c384c0ed6e23ac79386/lib/pg_trunk/core/adapters/postgres.rb
lib/pg_trunk/core/adapters/postgres.rb
# frozen_string_literal: true module PGTrunk # @private # PGTrunk database adapters. # # PGTrunk ships with a Postgres adapter only, # with interface implemented as +PGTrunk::Adapters::Postgres+. # module Adapters # Creates an instance of the PGTrunk Postgres adapter. # This is the only supported...
ruby
MIT
d8d55e53121d01885da55c384c0ed6e23ac79386
2026-01-04T17:41:54.025977Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db.rb
db.rb
require 'active_record' require 'yaml' env = ENV['RACK_ENV'] || 'development' ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML.load(IO.read('config/database.yml'))[env])
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/app.rb
app.rb
Cuba.define do on get do on root do res.write '<p>Danos un código postal y te regresamos la colonia, municipio y estado. <p>Más información en <a href="https://rapidapi.com/acrogenesis-llc-api/api/mexico-zip-codes">https://rapidapi.com/acrogenesis-llc-api/api/mexico-zip-codes</a></p>' e...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/presenters/postal_codes.rb
presenters/postal_codes.rb
module PostalCodes def self.fetch_codes(code, limit = nil) postal_codes = search_postal_codes(code, limit) serialize('codigos_postales' => postal_codes) end def self.search_postal_codes(code, limit = nil) PostalCode.with_code_hint(code, limit) end def self.fetch_locations(code) locations = s...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/middleware/json_content_type.rb
middleware/json_content_type.rb
# Custom middleware to set JSON content type class JsonContentType def initialize(app) @app = app end def call(env) status, headers, response = @app.call(env) headers['Content-Type'] = 'application/json; charset=utf-8' if env['PATH_INFO'] != '/' [status, headers, response] end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/middleware/header_auth_check.rb
middleware/header_auth_check.rb
# Authentication middleware class HeaderAuthCheck def initialize(app) @app = app end def call(env) # Skip authentication for root path return @app.call(env) if env['PATH_INFO'] == '/' # Exit early if authentication environment variables are not set if !ENV['VALIDATE_HEADER'] || !ENV['VALIDAT...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db/migrate/001_schema.rb
db/migrate/001_schema.rb
class Schema < ActiveRecord::Migration[4.2] def change create_table :codigos_postales, force: true do |t| t.integer :codigo_postal t.string :colonia t.string :municipio t.string :estado end end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db/migrate/005_enable_unaccent_extension.rb
db/migrate/005_enable_unaccent_extension.rb
class EnableUnaccentExtension < ActiveRecord::Migration[7.0] def up execute 'CREATE EXTENSION IF NOT EXISTS unaccent;' end def down execute 'DROP EXTENSION IF EXISTS unaccent;' end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db/migrate/002_add_index_to_codigo_postal.rb
db/migrate/002_add_index_to_codigo_postal.rb
class AddIndexToCodigoPostal < ActiveRecord::Migration[4.2] def change add_index :codigos_postales, :codigo_postal end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db/migrate/003_change_codigo_postal_to_string.rb
db/migrate/003_change_codigo_postal_to_string.rb
class ChangeCodigoPostalToString < ActiveRecord::Migration[4.2] def change change_column :codigos_postales, :codigo_postal, :string end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/db/migrate/004_add_more_indices.rb
db/migrate/004_add_more_indices.rb
class AddMoreIndices < ActiveRecord::Migration[4.2] def change # Add indices for fields frequently used in queries add_index :codigos_postales, :estado add_index :codigos_postales, :municipio add_index :codigos_postales, :colonia # Add composite indices for common search patterns add_index :c...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/models/postal_code.rb
models/postal_code.rb
class PostalCode < ActiveRecord::Base self.table_name = 'codigos_postales' scope :with_code, ->(code) { where(codigo_postal: code) } def self.with_code_hint(code_hint, limit = nil) query = where('codigo_postal LIKE :prefix', prefix: "#{code_hint}%") .order(codigo_postal: :asc) .disti...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/spec/spec_helper.rb
spec/spec_helper.rb
ENV['RACK_ENV'] = 'test' ENV['VALIDATE_HEADER'] = 'X-RapidAPI-Key' ENV['VALIDATE_HEADER_VALUE'] = 'test_token' require 'rack/test' require 'rspec' require 'database_cleaner/active_record' require 'factory_bot' require 'faker' # Load application files require 'oj' require 'active_record' require 'pg' require 'logger' ...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/spec/presenters/postal_codes_spec.rb
spec/presenters/postal_codes_spec.rb
require 'spec_helper' RSpec.describe PostalCodes do describe '.fetch_by_location' do let(:test_estado) { 'Test Estado' } let(:test_municipio) { 'Test Municipio' } let(:test_colonia) { 'Test Colonia' } let(:test_codigo_postal1) { '12345' } let(:test_codigo_postal2) { '12346' } before do ...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/spec/requests/api_spec.rb
spec/requests/api_spec.rb
require 'spec_helper' RSpec.describe 'API' do let(:valid_token) { 'test_token' } before do header 'X-RapidAPI-Key', valid_token end describe 'GET /' do it 'returns welcome message' do get '/' expect(last_response).to be_ok expect(last_response.body).to include('Danos un código posta...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/spec/factories/postal_codes.rb
spec/factories/postal_codes.rb
FactoryBot.define do factory :postal_code do codigo_postal { Faker::Number.number(digits: 5).to_s } colonia { Faker::Address.community } municipio { Faker::Address.city } estado { Faker::Address.state } end end
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
acrogenesis/API-Codigos-Postales
https://github.com/acrogenesis/API-Codigos-Postales/blob/5078e6f2045497f20193167c22902d063b4e8bfc/spec/models/postal_code_spec.rb
spec/models/postal_code_spec.rb
require 'spec_helper' RSpec.describe PostalCode do describe '.with_code' do let!(:postal_code) { create(:postal_code, codigo_postal: '12345') } let!(:other_postal_code) { create(:postal_code, codigo_postal: '54321') } it 'returns postal codes matching the given code' do expect(described_class.with...
ruby
MIT
5078e6f2045497f20193167c22902d063b4e8bfc
2026-01-04T17:42:00.312097Z
false
beatrichartz/configurations
https://github.com/beatrichartz/configurations/blob/bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2/test/test_helper.rb
test/test_helper.rb
require 'simplecov' SimpleCov.start require 'pathname' require 'minitest' PATH = Pathname.new(File.dirname(__FILE__)) $LOAD_PATH.unshift PATH, File.expand_path('../../lib', __FILE__) require 'configurations' Dir[PATH.join('support', '**', '*.rb')].each(&method(:require)) Dir[PATH.join('configurations', 'shared', '*...
ruby
MIT
bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2
2026-01-04T17:42:00.685516Z
false
beatrichartz/configurations
https://github.com/beatrichartz/configurations/blob/bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2/test/support/setup.rb
test/support/setup.rb
module Test module Support module Setup def self.included(base) base.instance_eval do def self.inherited(child) super child.extend ClassMethods child.send :include, InstanceMethods child.class_eval <<-CODE module TestModule ...
ruby
MIT
bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2
2026-01-04T17:42:00.685516Z
false
beatrichartz/configurations
https://github.com/beatrichartz/configurations/blob/bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2/test/support/shared.rb
test/support/shared.rb
module Test module Support module Shared def shares_tests(*tests) tests.each do |test| include Tests::Shared.const_get(test.to_s.split('_').map(&:capitalize).join) end end end end end
ruby
MIT
bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2
2026-01-04T17:42:00.685516Z
false
beatrichartz/configurations
https://github.com/beatrichartz/configurations/blob/bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2/test/configurations/strict/test.rb
test/configurations/strict/test.rb
require 'test_helper' class TestStrict < ConfigurationsTest setup_with :strict shares_tests :properties, :properties_outside_block, :kernel_methods def test_respond_to_writer assert_respond_to @configuration, :p1= end def test_undefined_property assert_raises NoMethodError do @configuration.p...
ruby
MIT
bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2
2026-01-04T17:42:00.685516Z
false
beatrichartz/configurations
https://github.com/beatrichartz/configurations/blob/bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2/test/configurations/strict/test_defaults.rb
test/configurations/strict/test_defaults.rb
require 'test_helper' class TestStrictWithDefaults < ConfigurationsTest setup_with :strict shares_tests :defaults end
ruby
MIT
bd8ef480ca831e29b821ffc9ebeaed4ef46a9db2
2026-01-04T17:42:00.685516Z
false