Пример #1
0
 protected function createCustomersRangeTable()
 {
     $command = $this->createCommand();
     /* @var $command \UrbanIndo\Yii2\DynamoDb\Command */
     $table = \test\data\CustomerRange::tableName();
     if ($command->tableExists($table)) {
         $command->deleteTable($table)->execute();
     }
     $index = \test\data\CustomerRange::secondaryIndex()[0];
     $command->createTable($table, ['AttributeDefinitions' => [['AttributeName' => \test\data\CustomerRange::primaryKey()[0], 'AttributeType' => 'N'], ['AttributeName' => \test\data\CustomerRange::primaryKey()[1], 'AttributeType' => 'S'], ['AttributeName' => \test\data\CustomerRange::keySecondayIndex()[$index][1], 'AttributeType' => 'S']], 'KeySchema' => [['AttributeName' => \test\data\CustomerRange::primaryKey()[0], 'KeyType' => 'HASH'], ['AttributeName' => \test\data\CustomerRange::primaryKey()[1], 'KeyType' => 'RANGE']], 'LocalSecondaryIndexes' => [['IndexName' => $index, 'KeySchema' => [['AttributeName' => \test\data\CustomerRange::keySecondayIndex()[$index][0], 'KeyType' => 'HASH'], ['AttributeName' => \test\data\CustomerRange::keySecondayIndex()[$index][1], 'KeyType' => 'RANGE']], 'Projection' => ['ProjectionType' => 'ALL']]], 'ProvisionedThroughput' => ['ReadCapacityUnits' => 10, 'WriteCapacityUnits' => 10]])->execute();
 }