public function writeTable(WriterInterface $writer)
    {
        if (!$this->isExternal()) {
            $this->getColumns()->write($writer);
            $this->getIndices()->write($writer);
            $this->getForeignKeys()->write($writer);

            return self::WRITE_OK;
        }

        return self::WRITE_EXTERNAL;
    }