In addition to the support of different objects, we are solving a problem of interdependency between them. For example, you can create a table, then a function using its type as an argument, then check constraint and index using the function.
Another difference from the aforementioned gems is that we explicitly register all objects created by migrations in the special table (
pg_trunk). That lets us distinguish objects created by “regular” migration from temporary ones added manually and exclude the latter from the schema. We bind any object to a particular version of migration that added it. That’s how only those objects that belong to the current branch are dumped into the
As of today, we support the creation, modification, and dropping of the following objects:
- foreign keys (including multi-column ones)
- check constraints
- materialized views
- custom statistics
- enumerable types
- composite types
- domains types
indexes we reuse the ActiveRecord’s native methods. For
check constraints and
foreign keys, we support both the native definitions inside the table and standalone methods (like
create_foreign_key) with additional features. The other methods are implemented from scratch.
In the future, other objects like aggregate functions, range types, operators, collations, and more will be supported.