Strehler::Element::Role::Maintainer - Maintainer role
This role is used only during entity installation. It requires an install method to be implemented. Install method will be called by strehler script when used with the command initentity.
This role was introduced to collect helpers and introspective methods useful for installation.
strehler initentity My::Entity::Maintained
Using strehler script this way the system call the install method implemented in the entity passing as parameters the database handler defined using Dancer2 configuration and public directory. This two elements can be used to customize the enviroment as for entity requests.
arguments: $dbh, $schema_classes
$class->deploy_entity_on_db($dbh, ['My::Entity::Schema', 'My::Entity::Multilang::Schema']);
You can use this method to add new tables to site database. Define needed tables through DBIx::Schema classes, that call the method with the database handler and an array containing class names. Tables will be added to the database.
Defining classes array, order matters! If you have foreign keys ensure that the table that will be linke is already created. For example, always place main table first and multilang element second.
Writing this methos was a great pain and I had to hack a little many things. I tested it on MySQL and SQLite, but I don't know how it can behave in more exotic environments. Try it and tell me...