2017 © Pedro Peláez
 

library yii-migration-postgresql-sectioning

Migration for creating partitioing using Yii1/Yii2 framework.

image

svmk/yii-migration-postgresql-sectioning

Migration for creating partitioing using Yii1/Yii2 framework.

  • Thursday, October 22, 2015
  • by svmk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,547 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Postgresql sectioning for Yii1 and Yii2

EXAMPLE

DateTime partitiong by week of year on Yii1:, (*1)

<?php
use svmk\yiiMigrationSectioningPostgres\PostgresqlMigrationHelper;
use svmk\yiiMigrationSectioningPostgres\DateTimeWeekOfYearGrouping;
class m151019_123058_create_table_page_stat extends CDbMigration
{

    protected function getHelper() {
        $helper = new PostgresqlMigrationHelper(
            $this,
            'page_stat',
            array(
                'id' => 'bigserial NOT NULL PRIMARY KEY',
                'data_id' => 'BIGINT',
                'event_date' => 'TIMESTAMP',
                'region_id'  => 'INT',
                'city_id'    => 'INT',
                'views'      => 'INT',
            )
        );
        return $helper->grouping(
            new DateTimeWeekOfYearGrouping('id','event_date')
        );
    }
    public function getDbConnection()
    {
        return Yii::app()->statisticsDb;
    }
    public function safeUp()
    {
        $this->getHelper()->up(
            function($migration,$tableName,$columns,$config,$isMainTable){
                $migration->createTable(
                    $tableName,
                    $columns,
                    $config
                );
                if (!$isMainTable) {
                    $migration->createIndex($tableName.'_data_id',$tableName,'data_id');
                    $migration->createIndex($tableName.'_event_date',$tableName,'event_date');
                }
            }
        );
    }

    public function safeDown()
    {
        $this->getHelper()->down(function($migration,$tableName,$isMainTable){          
            $migration->dropTable($tableName);
        });
    }
}

FEATURES

For sectioning use these classes: * svmk\yiiMigrationSectioningPostgres\DateTimeDayOfYearGrouping - group by timestamp field day of year * svmk\yiiMigrationSectioningPostgres\DateTimeWeekOfYearGrouping - group by timestamp field week of year * svmk\yiiMigrationSectioningPostgres\IndexReminderOfDivisonGrouping - group by integer field - division with remainder, (*2)

REQUIREMENTS

PHP 5.3, (*3)

INSTALLATION

Require this package in your composer.json and run composer update:, (*4)

    "svmk/yii-migration-postgresql-sectioning": "*"

The Versions

22/10 2015

dev-master

9999999-dev

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

22/10 2015

0.0.8

0.0.8.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

22/10 2015

0.0.7

0.0.7.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

22/10 2015

0.0.6

0.0.6.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

20/10 2015

0.0.5

0.0.5.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

19/10 2015

0.0.4

0.0.4.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

19/10 2015

0.0.3

0.0.3.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov

19/10 2015

0.0.1

0.0.1.0

Migration for creating partitioing using Yii1/Yii2 framework.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Mikhail Svetov