| Conditions | 1 |
| Paths | 1 |
| Total Lines | 43 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
||
| 9 | public function up() { |
||
| 10 | $this->dbforge->add_field(array( |
||
| 11 | 'id' => array( |
||
| 12 | 'type' => 'MEDIUMINT', |
||
| 13 | 'constraint' => '8', |
||
| 14 | 'unsigned' => TRUE, |
||
| 15 | 'auto_increment' => TRUE |
||
| 16 | ), |
||
| 17 | 'chapter_id' => array( |
||
| 18 | 'type' => 'MEDIUMINT', |
||
| 19 | 'constraint' => '8', |
||
| 20 | 'unsigned' => TRUE |
||
| 21 | //FOREIGN KEY |
||
| 22 | ), |
||
| 23 | |||
| 24 | 'chapter' => array( |
||
| 25 | 'type' => 'VARCHAR', |
||
| 26 | 'constraint' => '255', |
||
| 27 | 'null' => FALSE |
||
| 28 | ), |
||
| 29 | |||
| 30 | 'updated_at' => array( |
||
| 31 | //Despite not actually creating the field here (it's instead done below), we still need this here so a key can be created properly. |
||
| 32 | // 'type' => 'TIMESTAMP', |
||
| 33 | // 'null' => FALSE, |
||
| 34 | // 'on_update' => FALSE |
||
| 35 | ) |
||
| 36 | )); |
||
| 37 | $this->dbforge->add_field('updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'); //CI is annoying and auto-appends ON UPDATE which we don't want. |
||
| 38 | $this->dbforge->add_key('id', TRUE); |
||
| 39 | $this->dbforge->add_key('chapter_id'); |
||
| 40 | $this->dbforge->add_key('updated_at'); |
||
| 41 | $this->dbforge->create_table('tracker_favourites'); |
||
| 42 | |||
| 43 | /*** Unique/Foreign Keys ***/ |
||
| 44 | //For whatever reason, dbforge lacks a unique/foreign key function. |
||
| 45 | $this->db->query('ALTER TABLE `tracker_favourites` ADD UNIQUE(`chapter_id`, `chapter`);'); |
||
| 46 | |||
| 47 | $this->db->query(' |
||
| 48 | ALTER TABLE `tracker_favourites` |
||
| 49 | ADD CONSTRAINT `FK_tracker_favourites_tracker_chapters` FOREIGN KEY (`chapter_id`) REFERENCES `tracker_chapters` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;' |
||
| 50 | ); |
||
| 51 | } |
||
| 52 | |||
| 57 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.