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.

@names = $schema->volatile_free_tables

The sorted names of the tables that have no volatile columns (every column is non-volatile) -- the tables whose written values can be trusted as-is.

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

$tables = $schema->_rekey_tables(\%mine, \%theirs)

Return a copy of the introspected tables hashref re-keyed so that a declared table which renames a physical table (via db_name) lands under the declared ORM name instead of its database name. This lets a declared alias and the introspected source collapse into a single merged table rather than leaving two entries behind for one physical table.

$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 <exodist7@gmail.com>

AUTHORS

Chad Granum <exodist7@gmail.com>

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/