user1105692
user1105692

Reputation: 99

phpcassa Schema

create column family PwdUrl with 
    default_validation_class=UTF8Type and key_validation_class=UTF8Type and 
    comparator =UTF8Type and 
    column_metadata = [ {
        column_name:createdAt, 
        validation_class:UTF8Type, 
        index_type: KEYS
    },{
        column_name:expireAt, 
        validation_class:UTF8Type, 
        index_type: KEYS}
    ] 

This is the schema I need to set up. Is it possible to do this using phpcassa? If not, what other options are there?

Upvotes: 0

Views: 417

Answers (1)

Tyler Hobbs
Tyler Hobbs

Reputation: 6932

Yes, you can do this with just phpcassa. You'll use the SystemManager class. Here's an example:

<?php
require_once('phpcassa/sysmanager.php');

$sys = SystemManager("localhost:9160");
$my_keyspace = "Keyspace1";
$cfattrs = array("column_type" => "Standard",
                 "comparator_type" => "UTF8Type",
                 "default_validation_class" => "UTF8Type",
                 "key_validation_class" => "UTF8Type");
$sys->create_column_family($my_keyspace, "PwdUrl", $cfattrs);
$sys->create_index($my_keyspace, "PwdUrl", "createdAt", "UTF8Type");
$sys->create_index($my_keyspace, "PwdUrl", "expireAt", "UTF8Type");
$sys->close();
?>

Upvotes: 4

Related Questions