PluginProbe
Datafeedr API / 1.0.125
Datafeedr API v1.0.125
1.4.3 1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 All 182 releases
datafeedr-api / src / Migrations / Migration_20180120151532_Add_Networks_Table.php

Migration_20180120151532_Add_Networks_Table.php in Datafeedr API 1.0.125, at src/Migrations/Migration_20180120151532_Add_Networks_Table.php

36 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace Datafeedr\Api\Migrations;
2
3 use Datafeedr\Api\Wuwei\Database\Table;
4 use Datafeedr\Api\Wuwei\Migrations\Migration_Interface;
5
6 class Migration_20180120151532_Add_Networks_Table extends Migration implements Migration_Interface {
7
8 public function run() {
9
10 $table = new Table( 'datafeedr_networks' );
11
12 if ( $table->exists() ) {
13 return;
14 }
15
16 $data = [
17 'id INT(11) NOT NULL COMMENT "Affiliate network ID."',
18 'name TEXT NOT NULL COMMENT "Affiliate network name."',
19 'network_group VARCHAR(100) NOT NULL COMMENT "Affiliate network general group name."',
20 'type VARCHAR(10) NOT NULL COMMENT "The type of records this network supports. Either product or coupon."',
21 'merchant_count INT(11) NOT NULL DEFAULT "0" COMMENT "The number of merchants supported by this affiliate network."',
22 'product_count INT(11) NOT NULL DEFAULT "0" COMMENT "The number of products supported by this affiliate network."',
23 'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT "The timestamp when network was added to this database."',
24 'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT "The timestamp when network was updated in this database."',
25 'deleted_at TIMESTAMP NULL DEFAULT NULL COMMENT "The timestamp if/when network was deleted from this database."',
26 'PRIMARY KEY (id)',
27 'KEY name (name(100))',
28 'KEY network_group (network_group)',
29 'KEY type (type)',
30 ];
31
32 $create_result = $table->create( $data );
33
34 error_log( '$create_result' . ': ' . print_r( $create_result, true ) );
35 }
36 }