public function createTable($name, $data)
    {
        $q = "CREATE TABLE {$name} (";
        foreach ($data as $key => $v) {
            $q .= $key;

            if (isset($v['type'])) {
                $q .= " {$v['type']}";
                if (isset($v['length'])) {
                    $q .= "({$v['length']})";
                } else {
                    if ($v['type'] != 'int' && $v['type'] != 'datetime') {
                        die ("Please set length for table: {$name} - column: {$key}");
                    }
                }

                if (isset($v['unsigned']) && $v['unsigned'] == true) {
                    $q .= " UNSIGNED";
                }

                if (!isset($v['null']) || $v['null'] == false) {
                    $q .= " NOT NULL";
                }

                if (isset($v['default'])) {
                    if (is_string($v['default'])) {
                        $v['default'] = "'{$v['default']}'";
                    }

                    $q .= " DEFAULT {$v['default']}";
                }

                if (isset($v['ai']) && $v['ai'] == true) {
                    $q .= " AUTO_INCREMENT";
                }

                if ((isset($v['unique']) && $v['unique'] == true) && (isset($v['primary']) && $v['primary'] == true)) {
                    die ("Unique or Primary?");
                }

                if (isset($v['unique']) && $v['unique'] == true) {
                    $q .= " UNIQUE";
                }

                if (isset($v['primary']) && $v['primary'] == true) {
                    $q .= " PRIMARY KEY";
                }

                if (isset($v['foreign']) && isset($v['foreign']['table']) && isset($v['foreign']['column'])) {
                    $q .= " ,FOREIGN KEY ({$key}) REFERENCES {$v['foreign']['table']}({$v['foreign']['column']})";

                    if (isset($v['foreign']['delete']) && $v['foreign']['delete'] == true) {
                        $q .= " ON DELETE CASCADE";
                    }

                    if (isset($v['foreign']['update']) && $v['foreign']['update'] == true) {
                        $q .= " ON UPDATE CASCADE";
                    }
                }

                $q .= ", ";

            } else {
                die ("Please set type of column ");
            }
        }

        $q = substr($q, 0, -2);
        $q .= ")";

        return $this->executeQuery($q);
    }