public static function install($persistence)
    {
        $schemaManager = $persistence->getDriver()->getSchemaManager();
        $schema = $schemaManager->createSchema();
        $fromSchema = clone $schema;

        try {
            $table = $schema->createTable(self::TABLE_NAME);
            $table->addOption('engine', 'InnoDB');
            $table->addColumn(static::COLUMN_USER_ID, "string", ["length" => 255]);
            $table->addColumn(static::COLUMN_USER_ROLES, "string", ["notnull" => true, "length" => 4096]);
            $table->addColumn(static::COLUMN_ACTION, "string", ["notnull" => false, "length" => 4096]);
            $table->addColumn(static::COLUMN_EVENT_TIME, 'decimal', ['precision' => 14, 'scale'=>4, "notnull" => true]);
            $table->addColumn(static::COLUMN_DETAILS, "text", ["notnull" => false]);
            $table->addIndex([static::COLUMN_USER_ID], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_USER_ID);
            $table->addIndex([static::COLUMN_EVENT_TIME], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_EVENT_TIME);
        } catch(SchemaException $e) {
            \common_Logger::i('Database Schema already up to date.');
        }

        $queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema);
        foreach ($queries as $query) {
            $persistence->exec($query);
        }

        return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('User activity log successfully registered.'));
    }
public static function install($persistence)
    {
        $schemaManager = $persistence->getDriver()->getSchemaManager();
        $schema = $schemaManager->createSchema();
        $fromSchema = clone $schema;

        try {
            $table = $schema->createTable(self::TABLE_NAME);
            $table->addOption('engine', 'InnoDB');
            $table->addColumn(static::COLUMN_USER_ID, "string", ["length" => 255]);
            $table->addColumn(static::COLUMN_USER_ROLES, "string", ["notnull" => true, "length" => 4096]);
            $table->addColumn(static::COLUMN_ACTION, "string", ["notnull" => false, "length" => 4096]);
            $table->addColumn(static::COLUMN_EVENT_TIME, 'decimal', ['precision' => 14, 'scale'=>4, "notnull" => true]);
            $table->addColumn(static::COLUMN_DETAILS, "text", ["notnull" => false]);
            $table->addIndex([static::COLUMN_USER_ID], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_USER_ID);
            $table->addIndex([static::COLUMN_EVENT_TIME], 'IDX_' . static::TABLE_NAME . '_' . static::COLUMN_EVENT_TIME);
        } catch(SchemaException $e) {
            \common_Logger::i('Database Schema already up to date.');
        }

        $queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema);
        foreach ($queries as $query) {
            $persistence->exec($query);
        }

        return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('User activity log successfully registered.'));
    }
public static function install ( $ persistence ) { $ schemaManager = $ persistence -> getDriver ( ) -> getSchemaManager ( ) ; $ schema = $ schemaManager -> createSchema ( ) ; $ fromSchema = clone $ schema ; try { $ table = $ schema -> createTable ( self :: TABLE_NAME ) ; $ table -> addOption ( 'engine' , 'InnoDB' ) ; $ table -> addColumn ( static :: COLUMN_USER_ID , "string" , [ "length" => 255 ] ) ; $ table -> addColumn ( static :: COLUMN_USER_ROLES , "string" , [ "notnull" => true , "length" => 4096 ] ) ; $ table -> addColumn ( static :: COLUMN_ACTION , "string" , [ "notnull" => false , "length" => 4096 ] ) ; $ table -> addColumn ( static :: COLUMN_EVENT_TIME , 'decimal' , [ 'precision' => 14 , 'scale' => 4 , "notnull" => true ] ) ; $ table -> addColumn ( static :: COLUMN_DETAILS , "text" , [ "notnull" => false ] ) ; $ table -> addIndex ( [ static :: COLUMN_USER_ID ] , 'IDX_' . static :: TABLE_NAME . '_' . static :: COLUMN_USER_ID ) ; $ table -> addIndex ( [ static :: COLUMN_EVENT_TIME ] , 'IDX_' . static :: TABLE_NAME . '_' . static :: COLUMN_EVENT_TIME ) ; } catch ( SchemaException $ e ) { \ common_Logger :: i ( 'Database Schema already up to date.' ) ; } $ queries = $ persistence -> getPlatform ( ) -> getMigrateSchemaSql ( $ fromSchema , $ schema ) ; foreach ( $ queries as $ query ) { $ persistence -> exec ( $ query ) ; } return new \ common_report_Report ( \ common_report_Report :: TYPE_SUCCESS , __ ( 'User activity log successfully registered.' ) ) ; }
Initialize log storage

@param \common_persistence_Persistence $persistence
@return \common_report_Report
Initialize log storage