NAME

DBIx::Thin::Schema - Schema DSL for DBIx::Thin

SYNOPSIS

package Your::Model;

use DBIx::Thin;
DBIx::Thin->setup(
    dsn => 'dbi:SQLite:model.sqlite',
    username => 'root',
    password => '',
);

1;

package Your::Model::User;

use DBIx::Thin::Schema;

# set user table schema settings
install_table user => schema {
    primary_key 'id';
    columns qw(id name created_at);

    trigger pre_insert => callback {
        # hook
    };

    trigger pre_update => callback {
        # hook
    };
};

# TODO: not implemented yet
install_inflate_rule '^name$' => callback {
    inflate {
        my $value = shift;
        # inflate hook
    };
    deflate {
        my $value = shift;
        # deflate hook
    };
};

1;