I would like to create(if not exists) partition tables for each month for some time in the future:
execute """
CREATE TABLE IF NOT EXISTS #{table}_p#{start_date.year}_#{month}
PARTITION OF #{table} FOR VALUES
FROM ('#{start_date}')
TO ('#{stop_date}')
"""
I run it dynamically, eg: for next 12 month starting from today.
I would like to make it during migration, but run it each time migration starts. I can't use Repo since in time of the migration it's not yet started. I didn't find any ability to do it with Ecto.Migration api.
Do you have any ideas how to achieve this?
mix ecto.migrateinstead ran your task first and then theecto.migrate? You may need to start the repo process yourself. - Everett