Doodle::Table::Helpers
Doodle Table Helpers
use Doodle; use Doodle::Table; my $ddl = Doodle->new; my $self = Doodle::Table->new( name => 'users', doodle => $ddl );
Helpers for configuring Table classes.
This package uses type constraints from:
Doodle::Library
This package implements the following methods:
binary(Str $name, Any %args) : Column
Registers a binary column and returns the Command object set.
# given: synopsis my $binary = $self->binary('resume');
boolean(Str $name, Any %args) : Column
Registers a boolean column and returns the Command object set.
# given: synopsis my $boolean = $self->boolean('verified');
char(Str $name, Any %args) : Column
Registers a char column and returns the Command object set.
# given: synopsis my $char = $self->char('level', size => 2);
date(Str $name, Any %args) : Column
Registers a date column and returns the Command object set.
# given: synopsis my $date = $self->date('start_date');
datetime(Str $name, Any %args) : Column
Registers a datetime column and returns the Command object set.
# given: synopsis my $datetime = $self->datetime('published_at');
datetime_tz(Str $name, Any %args) : Column
Registers a datetime column with timezone and returns the Command object set.
# given: synopsis my $datetime_tz = $self->datetime_tz('published_at');
decimal(Str $name, Any %args) : Column
Registers a decimal column and returns the Command object set.
# given: synopsis my $decimal = $self->decimal('point');
double(Str $name, Any %args) : Column
Registers a double column and returns the Command object set.
# given: synopsis my $double = $self->double('amount');
enum(Str $name, Any %args) : Column
Registers an enum column and returns the Command object set.
# given: synopsis my $enum = $self->enum('colors', options => [ 'red', 'blue', 'green' ]);
float(Str $name, Any %args) : Column
Registers a float column and returns the Command object set.
# given: synopsis my $float = $self->float('amount');
if_exists() : Table
Used with the delete method to denote that the table should be deleted only if it already exists.
delete
# given: synopsis $self->if_exists;
if_not_exists() : Table
Used with the create method to denote that the table should be created only if it doesn't already exist.
create
# given: synopsis $self->if_not_exists;
increments_big(Str $name, Any %args) : Column
Registers an auto-incrementing big integer (8-byte) column and returns the Command object set.
# given: synopsis my $increments_big = $self->increments_big('number');
increments_medium(Str $name, Any %args) : Column
Registers an auto-incrementing medium integer (3-byte) column and returns the Command object set.
# given: synopsis my $increments_medium = $self->increments_medium('number');
increments_small(Str $name, Any %args) : Column
Registers an auto-incrementing small integer (2-byte) column and returns the Command object set.
# given: synopsis my $increments_small = $self->increments_small('number');
integer(Str $name, Any %args) : Column
Registers an integer (4-byte) column and returns the Command object set.
# given: synopsis my $integer = $self->integer('number');
integer_big(Str $name, Any %args) : Column
Registers a big integer (8-byte) column and returns the Command object set.
# given: synopsis my $integer_big = $self->integer_big('number');
integer_big_unsigned(Str $name, Any %args) : Column
Registers an unsigned big integer (8-byte) column and returns the Command object set.
# given: synopsis my $integer_big_unsigned = $self->integer_big_unsigned('number');
integer_medium(Str $name, Any %args) : Column
Registers a medium integer (3-byte) column and returns the Command object set.
# given: synopsis my $integer_medium = $self->integer_medium('number');
integer_medium_unsigned(Str $name, Any %args) : Column
Registers an unsigned medium integer (3-byte) column and returns the Command object set.
# given: synopsis my $integer_medium_unsigned = $self->integer_medium_unsigned('number');
integer_small(Str $name, Any %args) : Column
Registers a small integer (2-byte) column and returns the Command object set.
# given: synopsis my $integer_small = $self->integer_small('number');
integer_small_unsigned(Str $name, Any %args) : Column
Registers an unsigned small integer (2-byte) column and returns the Command object set.
# given: synopsis my $integer_small_unsigned = $self->integer_small_unsigned('number');
integer_tiny(Str $name, Any %args) : Column
Registers a tiny integer (1-byte) column and returns the Command object set.
# given: synopsis my $integer_tiny = $self->integer_tiny('number');
integer_tiny_unsigned(Str $name, Any %args) : Column
Registers an unsigned tiny integer (1-byte) column and returns the Command object set.
# given: synopsis my $integer_tiny_unsigned = $self->integer_tiny_unsigned('number');
integer_unsigned(Str $name, Any %args) : Column
Registers an unsigned integer (4-byte) column and returns the Command object set.
# given: synopsis my $integer_unsigned = $self->integer_unsigned('number');
json(Str $name, Any %args) : Column
Registers a JSON column and returns the Command object set.
# given: synopsis my $json = $self->json('metadata');
morphs(Str $name) : ArrayRef[Column]
Registers columns neccessary for polymorphism and returns the Column object set.
# given: synopsis my $morphs = $self->morphs('parent');
no_morphs(Str $name) : ArrayRef[Command]
Registers a drop for {name}_fkey and {name}_type polymorphic columns and returns the Command object set.
{name}_fkey
{name}_type
# given: synopsis my $no_morphs = $self->no_morphs('profile');
no_timestamps() : ArrayRef[Command]
Registers a drop for created_at, updated_at and deleted_at columns and returns the Command object set.
created_at
updated_at
deleted_at
# given: synopsis my $no_timestamps = $self->no_timestamps;
primary(Str $name, Any %args) : Column
Registers primary key(s) and returns the Command object set.
# given: synopsis my $primary = $self->primary('id');
string(Str $name, Any %args) : Column
Registers a string column and returns the Command object set.
# given: synopsis my $string = $self->string('fname');
temporary() : Table
Denotes that the table created should be a temporary one.
# given: synopsis my $temporary = $self->temporary;
text(Str $name, Any %args) : Column
Registers a text column and returns the Command object set.
# given: synopsis my $text = $self->text('biography');
text_long(Str $name, Any %args) : Column
Registers a long text column and returns the Command object set.
# given: synopsis my $text_long = $self->text_long('biography');
text_medium(Str $name, Any %args) : Column
Registers a medium text column and returns the Command object set.
# given: synopsis my $text_medium = $self->text_medium('biography');
time(Str $name, Any %args) : Column
Registers a time column and returns the Command object set.
# given: synopsis my $time = $self->time('clock_in');
time_tz(Str $name, Any %args) : Column
Registers a time column with timezone and returns the Command object set.
# given: synopsis my $time_tz = $self->time_tz('clock_in');
timestamp(Str $name, Any %args) : Column
Registers a timestamp column and returns the Command object set.
# given: synopsis my $timestamp = $self->timestamp('verified');
timestamp_tz(Str $name, Any %args) : Column
Registers a timestamp_tz column and returns the Command object set.
# given: synopsis my $timestamp_tz = $self->timestamp_tz('verified');
timestamps() : ArrayRef[Column]
Registers created_at, updated_at and deleted_at columns and returns the Command object set.
# given: synopsis my $timestamps = $self->timestamps;
timestamps_tz() : ArrayRef[Column]
Registers created_at, updated_at and deleted_at columns with timezone and returns the Command object set.
# given: synopsis my $timestamps_tz = $self->timestamps_tz;
uuid(Str $name, Any %args) : Column
Registers a uuid column and returns the Command object set.
# given: synopsis my $uuid = $self->uuid('reference');
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Doodle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Doodle
CPAN shell
perl -MCPAN -e shell install Doodle
For more information on module installation, please visit the detailed CPAN module installation guide.