NAME

DBIx::EAV::Schema - Describes the physical EAV database schema.

SYNOPSIS

my $schema = DBIx:EAV::Schema->new(
    dbh          => $dbh,               # required
    tables       => \%tables            # required
    tenant_id    => $tenant_id,         # default undef
    table_prefix => 'my_eav_',          # default 'eav_'
);

DESCRIPTION

This class represents the physical eav database schema. Will never need to instantiate an object of this class directly.

CONSTRUCTOR OPTIONS

data_types

Arrayref of SQL data types that will be available to entity attributes. DBIx::EAV uses one value table for each data type listed here. See "deploy" in DBIx::EAV::Schema.

TABLES

This section describes the required tables and columns for the EAV system.

entity_types

This table stores all entities. All columns of of this table are presented as static attributes for all entity types. So you can add any number of columns in addition to the required ones.

attributes

relationships

type_hierarchy

entities

entity_relationships

<data_type>_values

METHODS

table

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

Returns a DBIx::EAV::Table representing the table $name.

dbh_do

data_types

has_data_type

deploy

Create the eav database tables.

$eav->schema->deploy( add_drop_table => 1 );

get_ddl

Returns the eav schema DDL in any of the supported SQL::Translator producers. If no argument is passed a producer for the current driver is used.

my $mysql_ddl = $eav->schema->get_ddl('MySQL');

db_driver_name

Shortcut for $self->dbh->{Driver}{Name}.

LICENSE

Copyright (C) Carlos Fernando Avila Gratz.

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

AUTHOR

Carlos Fernando Avila Gratz <cafe@kreato.com.br>