PluginProbe
ShiftController Employee Shift Scheduling / 4.9.76
ShiftController Employee Shift Scheduling v4.9.76
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / shifttypes / migration.php

migration.php in ShiftController Employee Shift Scheduling 4.9.76, at sh4/shifttypes/migration.php

70 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class SH4_ShiftTypes_Migration
3 {
4 public $dbForge;
5 public $migrationService;
6
7 public function __construct(
8 HC3_Hooks $hooks,
9 HC3_MigrationService $migrationService,
10
11 HC3_Database_DbForge $dbForge = NULL
12 )
13 {
14 $this->dbForge = $dbForge;
15 $this->migrationService = $migrationService;
16 }
17
18 public function up()
19 {
20 $currentVersion = $this->migrationService->getVersion( 'shifttypes' );
21
22 if( $currentVersion < 1 ){
23 $this->version1();
24 $this->migrationService->saveVersion( 'shifttypes', 1 );
25 }
26 }
27
28 public function version1()
29 {
30 if( $this->dbForge ){
31 $this->dbForge->add_field(
32 array(
33 'id' => array(
34 'type' => 'INT',
35 'null' => FALSE,
36 'unsigned' => TRUE,
37 'auto_increment' => TRUE
38 ),
39 'title' => array(
40 'type' => 'VARCHAR(255)',
41 'null' => FALSE,
42 ),
43 'starts_at' => array(
44 'type' => 'INT',
45 'null' => FALSE,
46 ),
47 'ends_at' => array(
48 'type' => 'INT',
49 'null' => FALSE,
50 ),
51 'break_starts_at' => array(
52 'type' => 'INT',
53 'null' => TRUE,
54 ),
55 'break_ends_at' => array(
56 'type' => 'INT',
57 'null' => TRUE,
58 ),
59 'range' => array(
60 'type' => 'VARCHAR(16)',
61 'null' => FALSE,
62 'default' => SH4_ShiftTypes_Model::RANGE_HOURS,
63 ),
64 )
65 );
66 $this->dbForge->add_key('id', TRUE);
67 $this->dbForge->create_table('shifttypes');
68 }
69 }
70 }