<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME

    MySQL::Workbench::DBIC - create DBIC scheme for MySQL workbench .mwb
    files

VERSION

    version 1.15

SYNOPSIS

        use MySQL::Workbench::DBIC;
    
        my $foo = MySQL::Workbench::DBIC-&gt;new(
            file           =&gt; '/path/to/file.mwb',
            output_path    =&gt; $some_path,
            namespace      =&gt; 'MyApp::DB',
            version_add    =&gt; 0.01,
            column_details =&gt; 1, # default 1
            use_fake_dbic  =&gt; 1, # default 0
        );
    
        $foo-&gt;create_schema;

METHODS

 new

    creates a new object of MySQL::Workbench::DBIC. You can pass some
    parameters to new:

      my $foo = MySQL::Workbench::DBIC-&gt;new(
        output_path       =&gt; '/path/to/dir',
        input_file        =&gt; '/path/to/dbdesigner.file',
        namespace         =&gt; 'MyApp::Database',
        result_namespace  =&gt; 'Core',
        version_add       =&gt; 0.001,
        schema_name       =&gt; 'MySchema',
        column_details    =&gt; 1,
        use_fake_dbic     =&gt; 1, # default 0.
        belongs_to_prefix =&gt; 'fk_',
        has_many_prefix   =&gt; 'has_',
        uppercase         =&gt; 1,
      );

    use_fake_dbic is helpful when DBIx::Class is not installed on the
    machine where you use this module.

 create_schema

    creates all the files that are needed to work with DBIx::Class schema:

    The main module that loads all classes and one class per table. If you
    haven't specified an input file, the module will croak.

ATTRIBUTES

 output_path

    sets / gets the output path for the scheme

      print $foo-&gt;output_path;

 input_file

    sets / gets the name of the Workbench file

      print $foo-&gt;input_file;

 column_details

    If enabled, the column definitions are more detailed. Default:
    disabled.

    Standard (excerpt from Result classes):

      __PACKAGE__-&gt;add_columns( qw/
        cert_id
        register_nr
        state
      );

    With enabled column details:

      __PACKAGE__-&gt;add_columns(
        cert_id =&gt; {
          data_type         =&gt; 'integer',
          is_nullable       =&gt; 0,
          is_auto_increment =&gt; 1,
        },
        register_nr =&gt; {
          data_type   =&gt; 'integer',
          is_nullable =&gt; 0,
        },
        state =&gt; {
          data_type     =&gt; 'varchar',
          size          =&gt; 1,
          is_nullable   =&gt; 0,
          default_value =&gt; 'done',
        },
      );

    This is useful when you use DBIx::Class::DeploymentHandler to deploy
    the columns correctly.

 version_add

    The files should be versioned (e.g. to deploy the DB via
    DBIx::Class::DeploymentHandler). On the first run the version is set to
    "0.01". When the schema file already exists, the version is increased
    by the value of version_add (default: 0.01)

 schema_name

    sets a new name for the schema. By default on of these names is used:

      DBIC_Scheme Database DBIC MyScheme MyDatabase DBIxClass_Scheme

 namespace

    sets / gets the name of the namespace. If you set the namespace to
    'Test' and you have a table named 'MyTable', the main module is named
    'Test::DBIC_Scheme' and the class for 'MyTable' is named
    'Test::DBIC_Scheme::Result::MyTable'

 result_namespace

    sets / gets the name of an optional result namespace. If you set the
    result_namespace to 'Core' and you have a table named 'MyTable', the
    class for 'MyTable' is named 'Test::DBIC_Scheme::Core::Result::MyTable'

 resultset_namespace

    sets / gets the name of an optional resultset namespace. If you set the
    resultset_namespace to 'Core' and you have a table named 'MyTable', the
    resultset class for 'MyTable' is named
    'Test::DBIC_Scheme::Core::ResultSet::MyTable'

 load_result_namespace

    Additional namespaces to be loaded from the main schema class:

      my $foo = MySQL::Workbench::DBIC-&gt;new(
        output_path       =&gt; '/path/to/dir',
        input_file        =&gt; '/path/to/dbdesigner.file',
        result_namespace  =&gt; 'Core',
        load_result_namespace  =&gt; 'Virtual', # can be an arrayref, too
      );

    The schema class loads all namespaces:

      __PACKAGE__-&gt;load_namespaces(
        result_namespace =&gt; ['Core', 'Virtual'],
      );

 load_resultset_namespace

    Additional namespaces to be loaded from the main schema class:

      my $foo = MySQL::Workbench::DBIC-&gt;new(
        output_path       =&gt; '/path/to/dir',
        input_file        =&gt; '/path/to/dbdesigner.file',
        result_namespace  =&gt; 'Core',
        load_resultset_namespace =&gt; [ 'Test', 'Virtual' ], # can be a string, too
      );

    The schema class loads all namespaces:

      __PACKAGE__-&gt;load_namespaces(
        resultset_namespace =&gt; ['Test', 'Virtual'],
        result_namespace    =&gt; 'Core';
      );

 prefix

    In relationships the accessor for the objects of the "other" table
    shouldn't have the name of the column. Otherwise it is very clumsy to
    get the orginial value of this table.

      'belongs_to' =&gt; 'fk_'
      'has_many' =&gt; 'has_'

    creates (col1 is the column name of the foreign key)

      __PACKAGE__-&gt;belongs_to( 'fk_col1' =&gt; 'OtherTable', {'foreign.col1' =&gt; 'self.col1' } );

 uppercase

    When uppercase is set to true the package names are CamelCase. Given
    the table names user, user_groups and groups, the package names would
    be *::User, *::UserGroups and *::Groups.

 skip_indexes

    When skip_indexes is true, the sub sqlt_deploy_hook that adds the
    indexes to the table is not created

 utf8

    If you use non-ASCII characters in table or column comments, you should
    set the utf8 attribute to a true value. Then every generated class has
    a use utf8; in it.

 belongs_to_prefix

 has_many_prefix

 has_one_prefix

 many_to_many_prefix

 version

 use_fake_dbic

 classes

 file

 inherit_from_core

    By default, the classes inherit from DBIx::Class and they load the
    components PK::Auto and Core. If you set inherit_from_core, the classes
    inherit from DBIx::Class::Core. and no extra components are loaded.

 parser

    The MySQL::Workbench::Parser object.

AUTHOR

    Renee Baecker &lt;reneeb@cpan.org&gt;

COPYRIGHT AND LICENSE

    This software is Copyright (c) 2018 by Renee Baecker.

    This is free software, licensed under:

      The Artistic License 2.0 (GPL Compatible)

</pre></body></html>