public static void setupTable ( String name , String cql ) { if ( Schema . instance . getCFMetaData ( AUTH_KS , name ) == null ) { try { CFStatement parsed = ( CFStatement ) QueryProcessor . parseStatement ( cql ) ; parsed . prepareKeyspace ( AUTH_KS ) ; CreateTableStatement statement = ( CreateTableStatement ) parsed . prepare ( ) . statement ; CFMetaData cfm = statement . getCFMetaData ( ) . copy ( CFMetaData . generateLegacyCfId ( AUTH_KS , name ) ) ; assert cfm . cfName . equals ( name ) ; MigrationManager . announceNewColumnFamily ( cfm ) ; } catch ( Exception e ) { throw new AssertionError ( e ) ; } } }
Set up table from given CREATE TABLE statement under system_auth keyspace if not already done so .