Mojolicious::Plugin::DbicSchemaViewer - Viewer for DBIx::Class schema definitions
Version 0.0200, released 2016-09-20.
$self->plugin(DbicSchemaViewer => { schema => Your::Schema->connect(...), });
This plugin is a definition viewer for DBIx::Class schemas. It currently offers two different views on the schema:
It lists all result sources with column definitions and and their relationships in table form.
It uses DBIx::Class::Visualizer to generate an entity-relationship model.
The following settings are available. It is recommended to use either "router" or "condition" to place the viewer behind some kind of authorization check.
An optional array reference consisting of schema classes. If set, only these classes are available for viewing.
If not set, all findable schema classes can be viewed.
Optional.
By default, the viewer is located at /dbic-schema-viewer.
/dbic-schema-viewer
$self->plugin(DbicSchemaViewer => { url => '/the-schema', schema => Your::Schema->connect(...), });
The viewer is instead located at /the-schema.
/the-schema
Note that the CSS and Javascript files are served under /dbic-schema-viewer regardless of this setting.
Optional. Can not be used together with "condition".
Use this when you which to place the viewer behind an under route:
under
my $secure = $app->routes->under('/secure' => sub { my $c = shift; return defined $c->session('logged_in') ? 1 : 0; }); $self->plugin(DbicSchemaViewer => { router => $secure, schema => Your::Schema->connect(...), });
Now the viewer is located at /secure/dbic-schema-viewer (if the check is successful).
/secure/dbic-schema-viewer
Optional. Can not be used together with "router".
Use this when you have a named condition you which to place the viewer behind:
$self->routes->add_condition(random => sub { return !int rand 4 }); $self->plugin(DbicSchemaViewer => { condition => 'random', schema => Your::Schema->connect(...), });
There is a demo available at http://dsv.code301.com/MadeUp::Book::Schema. Don't miss the help page for instructions.
dbic-schema-viewer - a small application (in /bin) for running this plugin standalone.
dbic-schema-viewer
/bin
DBIx::Class::Visualizer
https://github.com/Csson/p5-Mojolicious-Plugin-DbicSchemaViewer
https://metacpan.org/release/Mojolicious-Plugin-DbicSchemaViewer
Erik Carlsson <info@code301.com>
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mojolicious::Plugin::DbicSchemaViewer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::DbicSchemaViewer
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::DbicSchemaViewer
For more information on module installation, please visit the detailed CPAN module installation guide.