Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added TINYINT, LONGTEXT and DECIMAL data types
  • Loading branch information
asdsolutions committed Nov 2, 2012
1 parent e2dbd6e commit 64ba46a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libraries/Schema.php
Expand Up @@ -23,10 +23,12 @@ class Schema {
'integer' => 'INT',
'int' => 'INT',
'bigint' => 'BIGINT',
'decimal' => 'DECIMAL',
'string' => 'VARCHAR',
'varchar' => 'VARCHAR',
'char' => 'CHAR',
'text' => 'TEXT',
'longtext' => 'LONGTEXT',
'date' => 'DATE',
'datetime' => 'DATETIME',
'boolean' => 'TINYINT',
Expand Down Expand Up @@ -174,6 +176,20 @@ public function integer($column_name, $options = array()) {
), $options);
}

public function tinyint($column_name, $options = array()) {
$this->add_definition_rule($column_name, array(
'type' => 'TINYINT'
), $options);
}

public function decimal($column_name, $constraint = '10,2', $options = array()) {
$this->add_definition_rule($column_name, array(
'type' => 'DECIMAL',
'constraint' => $constraint,
'unsigned' => FALSE
), $options);
}

public function auto_increment_integer($column_name, $options = array()) {
$this->integer($column_name, array_merge(array(
'unsigned' => TRUE,
Expand Down Expand Up @@ -203,6 +219,12 @@ public function text($column_name, $options = array()) {
), $options);
}

public function longtext($column_name, $options = array()) {
$this->add_definition_rule($column_name, array(
'type' => 'LONGTEXT'
), $options);
}

public function boolean($column_name, $options = array()) {
$this->add_definition_rule($column_name, array(
'type' => 'TINYINT'
Expand Down

0 comments on commit 64ba46a

Please sign in to comment.