Add a swoole table to existing tables.

@param string      $name
@param SwooleTable $table

@return Table
6390
public function add(string $name, SwooleTable $table)
    {
        $this->tables[$name] = $table;

        return $this;
    }
231462
public function getTable($name)
	{

		if (!isset($this->_tables[$name]))
            $this->_tables[$name] = $this->_createTable($name);

        return $this->_tables[$name];
	}
1201100
public static function existe($name, $table = null)
    {
        $object = get_class(self::$driver);

        return $object::existe($name, $table);
    }
876625
public function table(string $name) : Table\TableDefiner
    {
        return new TableDefiner($name, function (ITableDisplay $table) {
            $this->tables[$table->getName()] = $table;
        }, $this->tables);
    }
215205
public function setTable(\TechPromux\DynamicQueryBundle\Entity\MetadataTable $table)
    {
        $this->table = $table;

        return $this;
    }
1100300
protected function loadTable($name)
	{
		$table=new COciTableSchema;
		$this->resolveTableNames($table,$name);

		if(!$this->findColumns($table))
			return null;
		$this->findConstraints($table);

		return $table;
	}
931198
public function renameTable($table, $name)
    {
        //Argument 1 must be a string, 2 must be string
        Argument::i()->test(1, 'string')->argument(2, 'string');
        
        $this->query = 'RENAME TABLE `' . $table . '` TO `' . $name . '`';
        return $this;
    }
303501
public function copy(string $newTableName = null): Table {
		if (is_null($newTableName)) {
			$newTableName = $this->getName();
		}
		$newTable = new PgsqlTable($newTableName);
		
		$newTable->applyColumnsFrom($this);
		$newTable->applyIndexesFrom($this);
		return $newTable;
	}
1136486
public static function add($name, $script)
    {
        if (self::existe($name)) {
            $name = self::table($name);
            //
            self::$query = 'alter table '.$name.' ';
            //
            $object = new self();
            $script($object);
            //
            $query = '';
            for ($i = 0; $i < Collection::count(self::$colmuns); $i++) {
                $query .= ' add '.self::$colmuns[$i].(($i == (Collection::count(self::$colmuns) - 1)) ? '' : ',');
            }
            //
            self::$query .= $query;
            //
            return Database::exec(self::$query);
        } else {
            throw new SchemaTableNotExistException($name);
        }
    }
651328
public function addTable(TableInterface $table)
    {
        $table->setSchema($this);
        $this->_tables[$table->getName()] = $table;
        return $this;
    }
196747
private function add(string $name, string $class, string $table = null) : bool
  {
    $migrations = ModulusCLI::$appdir . 'database' . DIRECTORY_SEPARATOR . 'migrations';
    $date = date('Y_m_d_H_i_s');
    $migration = $migrations . DIRECTORY_SEPARATOR . $date . '_' . $name . '.php';

    ModulusCLI::_dir($migrations);

    if ($table != null) {
      $content = Template::asset('migration_add_template');
      $content = str_replace('{migration_class}', $class, $content);
      $content = str_replace('{migration_name}', $name, $content);
      $content = str_replace('{table_name}', $table, $content);
    }
    else {
      $content = Template::asset('migration_template');
      $content = str_replace('{migration_class}', $class, $content);
      $content = str_replace('{migration_name}', $name, $content);
    }

    if (file_exists($migration)) {
      return false;
    }
    else {
      file_put_contents($migration, $content);
      return true;
    }
  }
950252
public static function existe($name, $table = null)
    {
        $name = self::table($name);
        //
        // > I don't know why i put this
        $table = is_null($table) ? Config::get('database.database') : $table;
        //
        $i = Database::count(
                "select * FROM information_schema.tables WHERE table_schema ='".$table."' AND table_name = '".$name."' LIMIT 1;"
            );
        //
        return ($i > 0) ? true : false;
    }
943834
public function from($table, /*# string */ $alias = '')
    {
        $tbl = $this->fixTable($table, $alias);
        $this->tables = array_merge($this->tables, $tbl);
        return $this;
    }
1336992
public static function getInstance(string $name): \Swoole\Table
    {
        if(!static::$isInited)
        {
            throw new \RuntimeException('getInstance failed, MemoryTableManager is not initialized');
        }
        if(!isset(static::$tables[$name]))
        {
            throw new \RuntimeException(sprintf('GetInstance failed, %s is not found', $name));
        }
        return static::$tables[$name];
    }
241077
public function dropColumn( $table, $name )
    {
        try
        {
            $tmpTable = $table . '_old';

            $this->startTransaction();

            $this->copyTable( $table, $tmpTable, [ $name ] );

            $this->dropTable( $tmpTable );

            $this->commitTransaction();
        }
        catch ( Exception $e )
        {
            $this->rollbackTransaction();

            return FALSE;
        }

        return TRUE;
    }
818768
protected function populateStub($name, $stub, $table)
	{
		$stub = str_replace('{{class}}', studly_case($name), $stub);

		// Here we will replace the table place-holders with the table specified by
		// the developer, which is useful for quickly creating a tables creation
		// or update migration from the console instead of typing it manually.
		if ( ! is_null($table))
		{
			$stub = str_replace('{{table}}', $table, $stub);
		}

		return $stub;
	}
895216
public function dropIndex($table, $name)
    {
        $query = sprintf('DROP INDEX %s ON %s ;', $this->quote($name), $this->quote($table));

        $this->append($query);
        return $this;
    }