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

Sweet::Schema

SYNOPSIS

In lib/My/Project.pm.

package My::Project;
use Moose;

with 'Sweet::Schema';

__PACKAGE__->meta->make_immutable;

Generate lib/My/Project/Schema.pm and its Result subclasses with

$ dbicdump -o  dump_directory=./lib My::Project::Schema dbi:Oracle:XE scott tiger
Dumping manual schema for My::Project::Schema to directory ./lib ...
Schema dump completed.

In lib/My/Project/DatabaseConnection.pm

package My::Project::DatabaseConnection;
use Moose;

with 'My::Project::Config';

__PACKAGE__->meta->make_immutable;

In lib/My/Project/Config.pm

package My::Project::DatabaseConnection;
use Moose;

extends 'Sweet::DatabaseConnection';

with 'My::Project::Config';

__PACKAGE__->meta->make_immutable;

In $HOME/.myproject.yml

My:
  Project:
    DatabaseConnection:
      datasource: dbi:Oracle:XE
      username: scott
      password: tiger

ATTRIBUTES

_database_connection_class

Defaults to __PACKAGE__::DatabaseConnection.

_schema_class

Defaults to __PACKAGE__::Schema.

schema