DbTableHelper
    
            
            in package
            
        
    
    
    
Class DbTableHelper.
Tags
Table of Contents
Constants
- PRIVACY_COLUMN = 'privacy'
 - PRIVACY_ID_COLUMN = 'privacy_id'
 
Methods
- activeColumn() : ColumnDefinition
 - Add "is_active" column, type=unsigned tiny integer.
 - addMisingTotalColumn() : bool
 - model must contain fillable $column.
 - adminColumn() : ColumnDefinition
 - Add is_admin column, unsigned tiny integer default =0.
 - aggreateManualModified() : mixed
 - approvedColumn() : void
 - Create is_approved column.
 - categoryDataTable() : void
 - Create *_category_data table.
 - categoryTable() : void
 - Create category table.
 - countryColumns() : void
 - Create country_iso, country_child_id, postal_code, city columns.
 - createFullTextIndex() : mixed
 - Create full_text index.
 - createTagDataTable() : void
 - Create *_tag_data table.
 - deleteDuplicatedRows() : mixed
 - dropFullTextIndex() : mixed
 - Drop full_text index.
 - dropStreamTables() : void
 - Drop both stream network and privacy stream privacy table.
 - entityTypeColumn() : void
 - Create entity_type column.
 - featuredColumn() : void
 - Create is_featured and featured_at columns.
 - feedContentColumn() : void
 - Create `content` text column.
 - getDatabaseSize() : mixed
 - getDriverVersion() : mixed
 - imageColumns() : void
 - Create image_path and server_id columns.
 - locationColumn() : void
 - Create location_latitude, location_longitude and location_name columns.
 - migrateCoreItemStatisticCounter() : mixed
 - migrateCounter() : mixed
 - moduleColumn() : void
 - Create module_id column.
 - morphColumn() : void
 - Create morph columns.
 - morphColumnIndexedType() : void
 - Create morph column with index type.
 - morphImage() : void
 - Create columns to describe image.
 - morphItemColumn() : void
 - Create item_id and item_type columns.
 - morphItemWithTypeColumn() : void
 - Create item_id, item_type and type_id columns.
 - morphNullableItemColumn() : void
 - morphOwnerColumn() : void
 - Create owner_id and owner_type columns.
 - morphUserColumn() : void
 - Create user_id and user_type columns.
 - pricingColumns() : void
 - Add a pair of column which represents the item pricing and currency.
 - privacyColumn() : void
 - Create a privacy column.
 - privacyIdColumn() : void
 - create a privacy_id column.
 - privacyTypeColumn() : void
 - Create privacy_type and privacy_item column.
 - publicColumn() : void
 - Create is_public column.
 - resourceTextColumns() : mixed
 - Create text and text_parsed columns.
 - setupNetworkStreamTable() : void
 - Create a network privacy stream table.
 - setupPrivacyStreamTable() : void
 - Create a privacy stream table.
 - setupResourceColumns() : void
 - Setup user, owner, item, privacy, like, comment, share for a table.
 - sponsorColumn() : void
 - Create is_sponsor and sponsor_in_feed columns.
 - streamTables() : void
 - Create both network and privacy stream table.
 - tagsColumns() : ColumnDefinition
 - Create tags column, medium text.
 - textTable() : void
 - Create *_text table.
 - totalColumns() : void
 - Create integer columns.
 - viewColumn() : void
 - Create view_id column.
 
Constants
PRIVACY_COLUMN
    public
        mixed
    PRIVACY_COLUMN
    = 'privacy'
    
    
    
PRIVACY_ID_COLUMN
    public
        mixed
    PRIVACY_ID_COLUMN
    = 'privacy_id'
    
    
    
Methods
activeColumn()
Add "is_active" column, type=unsigned tiny integer.
    public
            static        activeColumn(Blueprint $table[, int $defaultValue = 1 ]) : ColumnDefinition
    Parameters
- $table : Blueprint
 - $defaultValue : int = 1
 
Return values
ColumnDefinitionaddMisingTotalColumn()
model must contain fillable $column.
    public
            static        addMisingTotalColumn(Model $model, string $column) : bool
    Parameters
- $model : Model
 - $column : string
 
Return values
booladminColumn()
Add is_admin column, unsigned tiny integer default =0.
    public
            static        adminColumn(Blueprint $table[, int $defaultValue = 0 ]) : ColumnDefinition
    Parameters
- $table : Blueprint
 - $defaultValue : int = 0
 
Return values
ColumnDefinitionaggreateManualModified()
    public
            static        aggreateManualModified(string $modelClass[, string $modifiedColumn = 'is_modified' ][, string $updatedColumn = 'updated_at' ]) : mixed
    Parameters
- $modelClass : string
 - $modifiedColumn : string = 'is_modified'
 - $updatedColumn : string = 'updated_at'
 
approvedColumn()
Create is_approved column.
    public
            static        approvedColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
categoryDataTable()
Create *_category_data table.
    public
            static        categoryDataTable(string $tableName[, string $parentName = 'category_id' ]) : void
    Parameters
- $tableName : string
 - $parentName : string = 'category_id'
 
categoryTable()
Create category table.
    public
            static        categoryTable(string $tableName[, bool|false $parentId = false ][, bool $level = false ]) : void
    Parameters
- $tableName : string
 - $parentId : bool|false = false
 - $level : bool = false
 
Tags
countryColumns()
Create country_iso, country_child_id, postal_code, city columns.
    public
            static        countryColumns(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
createFullTextIndex()
Create full_text index.
    public
            static        createFullTextIndex(string $table, string $column, array<string|int, string> $columns) : mixed
    Parameters
- $table : string
 - $column : string
 - $columns : array<string|int, string>
 
createTagDataTable()
Create *_tag_data table.
    public
            static        createTagDataTable(string $tableName) : void
    Parameters
- $tableName : string
 
deleteDuplicatedRows()
    public
            static        deleteDuplicatedRows(string $tableName, string $primaryKey, array<string|int, mixed> $uniqueColumns) : mixed
    Parameters
- $tableName : string
 - $primaryKey : string
 - $uniqueColumns : array<string|int, mixed>
 
dropFullTextIndex()
Drop full_text index.
    public
            static        dropFullTextIndex(string $table, string $column) : mixed
    Parameters
- $table : string
 - $column : string
 
dropStreamTables()
Drop both stream network and privacy stream privacy table.
    public
            static        dropStreamTables(string $tableName) : void
    Parameters
- $tableName : string
 
entityTypeColumn()
Create entity_type column.
    public
            static        entityTypeColumn(Blueprint $table[, bool $nullable = true ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = true
 
featuredColumn()
Create is_featured and featured_at columns.
    public
            static        featuredColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
feedContentColumn()
Create `content` text column.
    public
            static        feedContentColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
getDatabaseSize()
    public
            static        getDatabaseSize() : mixed
    getDriverVersion()
    public
            static        getDriverVersion() : mixed
    imageColumns()
Create image_path and server_id columns.
    public
            static        imageColumns(Blueprint $table[, string $fileIdColumn = 'image_file_id' ]) : void
    Parameters
- $table : Blueprint
 - $fileIdColumn : string = 'image_file_id'
 
locationColumn()
Create location_latitude, location_longitude and location_name columns.
    public
            static        locationColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
migrateCoreItemStatisticCounter()
    public
            static        migrateCoreItemStatisticCounter(string $column, string $insertSql, string $updateSql, bool $dryrun) : mixed
    Parameters
- $column : string
 - $insertSql : string
 - $updateSql : string
 - $dryrun : bool
 
migrateCounter()
    public
            static        migrateCounter(Model $model, string $updateColumn, Builder $query, string $primaryKey, string $foreignKey, bool $dryrun) : mixed
    Parameters
- $model : Model
 - $updateColumn : string
 - $query : Builder
 - $primaryKey : string
 - $foreignKey : string
 - $dryrun : bool
 
moduleColumn()
Create module_id column.
    public
            static        moduleColumn(Blueprint $table[, bool $nullable = true ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = true
 
morphColumn()
Create morph columns.
    public
            static        morphColumn(Blueprint $table, string $name[, bool $nullable = false ][, string|null $indexName = null ]) : void
    Parameters
- $table : Blueprint
 - $name : string
 - $nullable : bool = false
 - $indexName : string|null = null
 
Tags
morphColumnIndexedType()
Create morph column with index type.
    public
            static        morphColumnIndexedType(Blueprint $table, string $name[, bool $nullable = false ][, string|null $indexName = null ]) : void
    Parameters
- $table : Blueprint
 - $name : string
 - $nullable : bool = false
 - $indexName : string|null = null
 
Tags
morphImage()
Create columns to describe image.
    public
            static        morphImage(Blueprint $table, string $columnPrefix) : void
    Parameters
- $table : Blueprint
 - $columnPrefix : string
 - 
                    
Example
photo, create columns photo_id, photo_type 
morphItemColumn()
Create item_id and item_type columns.
    public
            static        morphItemColumn(Blueprint $table[, bool $nullable = false ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = false
 
morphItemWithTypeColumn()
Create item_id, item_type and type_id columns.
    public
            static        morphItemWithTypeColumn(Blueprint $table[, bool $nullable = false ][, string|null $indexName = null ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = false
 - $indexName : string|null = null
 
Tags
morphNullableItemColumn()
    public
            static        morphNullableItemColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
morphOwnerColumn()
Create owner_id and owner_type columns.
    public
            static        morphOwnerColumn(Blueprint $table[, bool $nullable = false ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = false
 
morphUserColumn()
Create user_id and user_type columns.
    public
            static        morphUserColumn(Blueprint $table[, bool $nullable = false ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = false
 
pricingColumns()
Add a pair of column which represents the item pricing and currency.
    public
            static        pricingColumns(Blueprint $table[, string $column = 'price' ]) : void
    Parameters
- $table : Blueprint
 - $column : string = 'price'
 
privacyColumn()
Create a privacy column.
    public
            static        privacyColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
privacyIdColumn()
create a privacy_id column.
    public
            static        privacyIdColumn(Blueprint $table[, bool $nullable = false ]) : void
    Parameters
- $table : Blueprint
 - $nullable : bool = false
 - 
                    
Optional, default=false
 
privacyTypeColumn()
Create privacy_type and privacy_item column.
    public
            static        privacyTypeColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
publicColumn()
Create is_public column.
    public
            static        publicColumn(Blueprint $table[, int $defaultValue = 1 ]) : void
    Parameters
- $table : Blueprint
 - $defaultValue : int = 1
 
resourceTextColumns()
Create text and text_parsed columns.
    public
            static        resourceTextColumns(Blueprint $table) : mixed
    Parameters
- $table : Blueprint
 
setupNetworkStreamTable()
Create a network privacy stream table.
    public
            static        setupNetworkStreamTable(string $tableName) : void
    Parameters
- $tableName : string
 
setupPrivacyStreamTable()
Create a privacy stream table.
    public
            static        setupPrivacyStreamTable(string $tableName) : void
    Parameters
- $tableName : string
 
setupResourceColumns()
Setup user, owner, item, privacy, like, comment, share for a table.
    public
            static        setupResourceColumns(Blueprint $table, bool $user, bool $owner, bool $privacy, bool $module) : void
    Parameters
- $table : Blueprint
 - $user : bool
 - $owner : bool
 - $privacy : bool
 - $module : bool
 
sponsorColumn()
Create is_sponsor and sponsor_in_feed columns.
    public
            static        sponsorColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint
 
streamTables()
Create both network and privacy stream table.
    public
            static        streamTables(string $tableName) : void
    Parameters
- $tableName : string
 
tagsColumns()
Create tags column, medium text.
    public
            static        tagsColumns(Blueprint $table[, bool $nullable = true ]) : ColumnDefinition
    Parameters
- $table : Blueprint
 - $nullable : bool = true
 
Return values
ColumnDefinitiontextTable()
Create *_text table.
    public
            static        textTable(string $tableName) : void
    Parameters
- $tableName : string
 
totalColumns()
Create integer columns.
    public
            static        totalColumns(Blueprint $table[, array<string|int, string> $columns = ['like', 'comment', 'share'] ]) : void
    Parameters
- $table : Blueprint
 - $columns : array<string|int, string> = ['like', 'comment', 'share']
 - 
                    
Example ['like','comment','share'], Create 'total_like', 'total_comment','total_share' columns.
 
viewColumn()
Create view_id column.
    public
            static        viewColumn(Blueprint $table) : void
    Parameters
- $table : Blueprint