The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojolicious::Plugin::DbicSchemaViewer - Viewer for DBIx::Class schema definitions

Requires Perl 5.20+ Travis status Distribution kwalitee CPAN Testers result coverage 65.3%

VERSION

Version 0.0102, released 2016-09-04.

SYNOPSIS

    $self->plugin(DbicSchemaViewer => {
        schema => Your::Schema->connect(...),
    });

DESCRIPTION

This plugin is a viewer for DBIx::Class schemata. It lists all ResultSources with column definitions and and their relationships. See examples/example.html for an example (also available on Github).

Optionally, if DBIx::Class::Visualizer is installed, a graphical representation of the schema can be rendered using GraphViz2.

Configuration

The following settings are available. It is recommended to use either "router" or "condition" to place the viewer behind some kind of authorization check.

schema

Mandatory.

An instance of a DBIx::Class::Schema class.

url

Optional.

By default, the viewer is located at /dbic-schema-viewer.

    $self->plugin(DbicSchemaViewer => {
        url => '/the-schema',
        schema => Your::Schema->connect(...),
    });

The viewer is instead located at /the-schema.

router

Optional. Can not be used together with "condition".

Use this when you which to place the viewer behind an under route:

    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).

condition

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(...),
    });

SOURCE

https://github.com/Csson/p5-Mojolicious-Plugin-DbicSchemaViewer

HOMEPAGE

https://metacpan.org/release/Mojolicious-Plugin-DbicSchemaViewer

AUTHOR

Erik Carlsson <info@code301.com>

COPYRIGHT AND LICENSE

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.