lib/pg_trunk/core/railtie/schema_dumper.rb
# Here we totally redefining the way a schema is dumped.
#
# In Rails every table definition is dumped as an `add_table`
# creator including all its columns, indexes, type casts and foreign keys.
#
# In some circumstances, these objects can have inter-dependencies
# with others (like functions, custom types and constraints).
# For example, we could define a function getting table raw as an argument,
# and then use this function to define check constraint for the table.
# In this case we must insert the definition of the function between
# the table's and constraint's ones.
#
# That's why we can neither rely on the method, defined in ActiveRecord
# nor reuse it through fallback to `super` like both Scenic and F(x) do.
# Instead of it, we fetch object definitions from the database,
# and then resolve their inter-dependencies.
Here we totally redefining the way a schema is dumped.
In Rails every table definition is dumped as an `add_table`
creator including all its columns, indexes, type casts and foreign keys.

In some circumstances, these objects can have inter-dependencies
with others (like functions, custom types and constraints).
For example, we could define a function getting table raw as an argument,
and then use this function to define check constraint for the table.
In this case we must insert the definition of the function between
the table's and constraint's ones.

That's why we can neither rely on the method, defined in ActiveRecord
nor reuse it through fallback to `super` like both Scenic and F(x) do.
Instead of it, we fetch object definitions from the database,
and then resolve their inter-dependencies.
Here we totally redefining the way a schema is dumped . In Rails every table definition is dumped as an ` add_table ` creator including all its columns indexes type casts and foreign keys . In some circumstances these objects can have inter - dependencies with others ( like functions custom types and constraints ) . For example we could define a function getting table raw as an argument and then use this function to define check constraint for the table . In this case we must insert the definition of the function between the table ' s and constraint ' s ones . That ' s why we can neither rely on the method defined in ActiveRecord nor reuse it through fallback to ` super ` like both Scenic and F ( x ) do . Instead of it we fetch object definitions from the database and then resolve their inter - dependencies .
def dump(stream)
      pg_trunk_register_custom_types
      header(stream)
      extensions(stream)
      pg_trunk_objects(stream)
      trailer(stream)
      stream
    end
def dump ( stream ) pg_trunk_register_custom_types header ( stream ) extensions ( stream ) pg_trunk_objects ( stream ) trailer ( stream ) stream end
Here we totally redefining the way a schema is dumped.
Here we totally redefining the way a schema is dumped .
stream
<not_specific>