Opened 7 years ago

Closed 5 years ago

#29377 closed New feature (wontfix)

DatabaseSchemaEditor: add a hook to run DML statements after the entire schema is created

Reported by: Maximiliano Robaina Owned by: nobody
Component: Migrations Version: 2.0
Severity: Normal Keywords:
Cc: Maximiliano Robaina, Simon Charette Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Maximiliano Robaina)

A nice option would be to have a hook to run DML statements after all migrations were applied and commited.

A uses case (for example in Firebird SQL) is to add a new field on already existing and populated table. Is not enough set and drop a default value, we need to update the new field with efective default value. It is not possible without commit the schema alteration.
An aproach could be to have a kind of hook to run sql statements (DML statement in this case) when the schema altereation finished (and commited). Of course, must bu runned in another transaction.

This feature request is to better support of third-party database backends.

Change History (5)

comment:1 by Tim Graham, 7 years ago

Did you forgot about #26399 that you created or is this is a different issue?

comment:2 by Maximiliano Robaina, 7 years ago

Tim,

It's a different issue. May be I need to write It better.
In this case is just for run a DML statement after all migrations were applied (and commited). About change of defaults values that I mencioned is just an uses case.

comment:3 by Maximiliano Robaina, 7 years ago

Cc: Maximiliano Robaina added
Description: modified (diff)

comment:4 by Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted

comment:5 by Simon Charette, 5 years ago

Cc: Simon Charette added
Resolution: wontfix
Status: newclosed

Any reason why a post_migrate receiver cannot be used for this purpose?

The schema editor and migration logic are decoupled for a good reason and adding such a hook would introduce bidirectional coupling between the two components.

I'll close as wontfix for the above reasons.

Note: See TracTickets for help on using tickets.
Back to Top