NAME

DBIx::QuickORM::Schema - Object representing a database schema.

DESCRIPTION

This object represents a single schema in the database. This includes tables, indexes, columns, etc.

SYNOPSIS

In your custom ORM package:

package My::ORM;
use strict;
use warnings;

use DBIx::QuickORM;

orm MyORM => sub {
    schema MySchema => sub {
        ...
    };
    ...
}

In other code:

use My::ORM qw/orm/;

my $schema = orm('MyORM')->schema;

METHODS

$schema->add_table($table_name, $table_ref)

Add a table to the schema. Requires a table name and an DBIx::QuickORM::Schema::Table instance.

An exception will be thrown if a table of the given name already exists.

$new_schema = $schema->clone(%overrides)

Create a copy of the schema, with any attributes you wish to have changed in the copy.

$trace = $schema->compiled()

May be undef. A string like 'FILENAME line LINENUM' in most cases. This trace tells you where the schema object was compiled.

$trace = $schema->created()

May be undef. A string like 'FILENAME line LINENUM' in most cases. This trace tells you where the schema object was initially defined.

$schema3 = $schema->merge($schema2)

Merge 2 schema objects into a single third one.

$name = $schema->name()

Get the name of the schema.

$class = $schema->row_class()

Get the row class used by default when fetching rows from this schema. This can be overriden on a per-table basis.

$table = $schema->table($name)

Get the table of the specified name. An exception will be thrown if the table is not defined.

$table_or_undef = $schema->maybe_table($table_name)

Get the table with the specified name. Return undef if the table is not defined.

@tables = $schema->tables()

Get all table objects. Each item is an instance of DBIx::QuickORM::Schema::Table.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See https://dev.perl.org/licenses/