Efcore.pg: How to customize table creation (migration) for partitioning and inherited tables

Created on 30 Apr 2020  路  3Comments  路  Source: npgsql/efcore.pg

Can anyone shed light on the correct process of altering a table-creation in an EF core migration so that the table has partitioning and inherited tables?

All 3 comments

Neither of these is currently implemented:

  • Partitioning is tracked by #1035.
  • PostgreSQL inheritance is tracked on the EF Core side by #10739. But you can still use EF Core's regular inheritance (TPH) as detailed here - it's just not the PostgreSQL inheritance feature.

Note that you can set up table partitioning up yourself without any help from EF Core: just generate a migration to create your table, and then edit it and use raw SQL to add the necessary clause. You may be able to get away with it for PostgreSQL inheritance as well, but I'm not really sure.

@roji thanks for the reply - shortly after posting this, I just went ahead and wrote the script by hand

Great, good to hear it worked out.

Was this page helpful?
0 / 5 - 0 ratings