/** * @param Schema $Schema * * @return Table * @throws SchemaException */ private function setTableToken(Schema &$Schema) { /** * Install */ $Table = $this->Connection->createTable($Schema, 'tblToken'); /** * Upgrade */ if (!$this->Connection->hasColumn('tblToken', 'Identifier')) { $Table->addColumn('Identifier', 'string'); } if (!$this->Connection->hasIndex($Table, array('Identifier'))) { $Table->addUniqueIndex(array('Identifier')); } if (!$this->Connection->hasColumn('tblToken', 'Serial')) { $Table->addColumn('Serial', 'string', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('Serial'))) { $Table->addUniqueIndex(array('Serial')); } if (!$this->Connection->hasColumn('tblToken', 'serviceTblConsumer')) { $Table->addColumn('serviceTblConsumer', 'bigint', array('notnull' => false)); } return $Table; }
/** * @param Schema $Schema * * @return Table */ private function setTableProtocol(Schema &$Schema) { /** * Install */ $Table = $this->Connection->createTable($Schema, 'tblProtocol'); /** * Upgrade */ // System if (!$this->Connection->hasColumn('tblProtocol', 'ProtocolDatabase')) { $Table->addColumn('ProtocolDatabase', 'string', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('ProtocolDatabase'))) { $Table->addIndex(array('ProtocolDatabase')); } if (!$this->Connection->hasColumn('tblProtocol', 'ProtocolTimestamp')) { $Table->addColumn('ProtocolTimestamp', 'integer', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('ProtocolTimestamp'))) { $Table->addIndex(array('ProtocolTimestamp')); } // Editor if (!$this->Connection->hasColumn('tblProtocol', 'serviceTblAccount')) { $Table->addColumn('serviceTblAccount', 'bigint', array('notnull' => false)); } if (!$this->Connection->hasColumn('tblProtocol', 'AccountUsername')) { $Table->addColumn('AccountUsername', 'string', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('AccountUsername'))) { $Table->addIndex(array('AccountUsername')); } // Consumer if (!$this->Connection->hasColumn('tblProtocol', 'serviceTblConsumer')) { $Table->addColumn('serviceTblConsumer', 'bigint', array('notnull' => false)); } if (!$this->Connection->hasColumn('tblProtocol', 'ConsumerName')) { $Table->addColumn('ConsumerName', 'string', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('ConsumerName'))) { $Table->addIndex(array('ConsumerName')); } if (!$this->Connection->hasColumn('tblProtocol', 'ConsumerAcronym')) { $Table->addColumn('ConsumerAcronym', 'string', array('notnull' => false)); } if (!$this->Connection->hasIndex($Table, array('ConsumerAcronym'))) { $Table->addIndex(array('ConsumerAcronym')); } // Data if (!$this->Connection->hasColumn('tblProtocol', 'EntityFrom')) { $Table->addColumn('EntityFrom', 'text', array('notnull' => false)); } if (!$this->Connection->hasColumn('tblProtocol', 'EntityTo')) { $Table->addColumn('EntityTo', 'text', array('notnull' => false)); } return $Table; }
/** * @param Schema $Schema * * @return Table */ private function setTableState(Schema &$Schema) { $Table = $this->Connection->createTable($Schema, 'tblState'); if (!$this->Connection->hasColumn('tblState', 'Name')) { $Table->addColumn('Name', 'string'); } if (!$this->Connection->hasIndex($Table, array('Name'))) { $Table->addUniqueIndex(array('Name')); } return $Table; }
/** * @param Schema $Schema * @param Table $tblAccount * * @return Table */ private function setTableSession(Schema &$Schema, Table $tblAccount) { $Table = $this->Connection->createTable($Schema, 'tblSession'); if (!$this->Connection->hasColumn('tblSession', 'Session')) { $Table->addColumn('Session', 'string'); } if (!$this->Connection->hasIndex($Table, array('Session'))) { $Table->addIndex(array('Session')); } if (!$this->Connection->hasColumn('tblSession', 'Timeout')) { $Table->addColumn('Timeout', 'integer'); } $this->Connection->addForeignKey($Table, $tblAccount); return $Table; }
/** * @param Schema $Schema * * @return Table */ private function setTableSubject(Schema &$Schema) { $Table = $this->Connection->createTable($Schema, 'tblSubject'); if (!$this->Connection->hasColumn('tblSubject', 'Acronym')) { $Table->addColumn('Acronym', 'string'); } if (!$this->Connection->hasIndex($Table, array('Acronym'))) { $Table->addUniqueIndex(array('Acronym')); } if (!$this->Connection->hasColumn('tblSubject', 'Name')) { $Table->addColumn('Name', 'string'); } if (!$this->Connection->hasColumn('tblSubject', 'Description')) { $Table->addColumn('Description', 'string'); } return $Table; }