[Cubicweb] [postgis] Enable Postgis extension the right way
Christophe de Vienne
christophe at unlish.com
Tue Jun 9 10:13:29 CEST 2015
Le 09/06/2015 09:00, Adrien Di Mascio a écrit :
> Hi all,
> Sylvain Thénault <sylvain.thenault at logilab.fr> writes:
>> The point is that we've db-create and db-init commands, with [pre/post]create.py
>> triggered during db-init. While it may sounds appealing to use postinit.py,
>> that fact that it will be called during db-create will make the whole thing even
>> more confusing...
> What about adding custom events (hooks ?) : pre/post-db-create,
> pre/post-db-init, maybe also pre/post-migration ?
pre/post db-create and pre db-init cannot, in my opinion, be hooks.
Hooks requires that most if not all the application is loaded.
And when not even the database is created, or the tables initialised, it
can cause difficulties.
Simple scripts, like precreate (but with a different name of couse)
would be safer.
For the particular case of extension creation, I would see some script
like migration/pre-db-init.py, which would be applied before any entity
or relation of a cube is added to the active schema.
More information about the Cubicweb