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;

ATTRIBUTES

name

The name of the schema.

tables

Hashref of table name to DBIx::QuickORM::Schema::Table instance.

created

Trace string for where the schema was initially defined.

compiled

Trace string for where the schema was compiled.

row_class

The row class used by default when fetching rows from this schema.

PUBLIC METHODS

@tables = $schema->tables()

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

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

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

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

Merge 2 schema objects into a single third one.

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

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

PRIVATE METHODS

Internal accessor that fetches and clears the pending raw link definitions.

$schema->_resolve_links()

Resolve the raw link definitions collected from the schema and its tables into DBIx::QuickORM::Link objects attached to the relevant tables.

SOURCE

The source code repository for DBIx::QuickORM can be found at 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/