function getSchema()
    {
        # Database structure
        $schema = 'CREATE TABLE IF NOT EXISTS ' . $this->table . ' (';
        $sep = PHP_EOL;

        foreach($this->schema as $fld) {
            $schema .= $sep . $fld;
            $sep = ', ' . PHP_EOL;
        }

        $schema .= PHP_EOL . ');' . PHP_EOL;

        # Indecies
        foreach($this->indecies as $index) {
            foreach($index as $type=>$field) {
                $type = strtolower($type);
                switch ($type) {
                    case 'u':
                    case 'unique':
                        $schema .=  'CREATE UNIQUE INDEX ';
                        break;
                    case 'i':
                    case 'index':
                    default:
                        $schema .=  'CREATE INDEX ';
                }
                $schema .=
                    "{$this->table}_{$field}_{$type}" .
                    ' ON ' . $this->table . '(' . $field . ');' . PHP_EOL;
            }
        }

        return $schema;
    }
function getSchema()
    {
        # Database structure
        $schema = 'CREATE TABLE IF NOT EXISTS ' . $this->table . ' (';
        $sep = PHP_EOL;

        foreach($this->schema as $fld) {
            $schema .= $sep . $fld;
            $sep = ', ' . PHP_EOL;
        }

        $schema .= PHP_EOL . ');' . PHP_EOL;

        # Indecies
        foreach($this->indecies as $index) {
            foreach($index as $type=>$field) {
                $type = strtolower($type);
                switch ($type) {
                    case 'u':
                    case 'unique':
                        $schema .=  'CREATE UNIQUE INDEX ';
                        break;
                    case 'i':
                    case 'index':
                    default:
                        $schema .=  'CREATE INDEX ';
                }
                $schema .=
                    "{$this->table}_{$field}_{$type}" .
                    ' ON ' . $this->table . '(' . $field . ');' . PHP_EOL;
            }
        }

        return $schema;
    }
function getSchema ( ) { # Database structure $ schema = 'CREATE TABLE IF NOT EXISTS ' . $ this -> table . ' (' ; $ sep = PHP_EOL ; foreach ( $ this -> schema as $ fld ) { $ schema .= $ sep . $ fld ; $ sep = ', ' . PHP_EOL ; } $ schema .= PHP_EOL . ');' . PHP_EOL ; # Indecies foreach ( $ this -> indecies as $ index ) { foreach ( $ index as $ type => $ field ) { $ type = strtolower ( $ type ) ; switch ( $ type ) { case 'u' : case 'unique' : $ schema .= 'CREATE UNIQUE INDEX ' ; break ; case 'i' : case 'index' : default : $ schema .= 'CREATE INDEX ' ; } $ schema .= "{$this->table}_{$field}_{$type}" . ' ON ' . $ this -> table . '(' . $ field . ');' . PHP_EOL ; } } return $ schema ; }
Creates the schema of the DB according to the defined
Creates the schema of the DB according to the defined