From e1438a01a0a4fad5013ea2938ffaed7467b829e5 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 5 Feb 2022 12:02:43 +0100 Subject: [PATCH] [Migration] Renamed to avoid duplicate with script 73. --- ...te_station_logbook_relationship_table2.php | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 application/migrations/083_create_station_logbook_relationship_table2.php diff --git a/application/migrations/083_create_station_logbook_relationship_table2.php b/application/migrations/083_create_station_logbook_relationship_table2.php new file mode 100644 index 00000000..b6f48a27 --- /dev/null +++ b/application/migrations/083_create_station_logbook_relationship_table2.php @@ -0,0 +1,92 @@ +db->table_exists('station_logbooks')) { + $this->dbforge->add_field(array( + 'logbook_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'unique' => TRUE + ), + + 'user_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'logbook_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '191', + 'null' => TRUE + ), + + 'modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ) + )); + + $this->dbforge->add_key('logbook_id', TRUE); + $this->dbforge->add_key('user_id', TRUE); + + $this->dbforge->create_table('station_logbooks'); + } + + if (!$this->db->table_exists('station_logbooks_relationship')) { + $this->dbforge->add_field(array( + 'logbook_relation_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'unique' => TRUE + ), + + 'station_logbook_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'station_location_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ) + )); + + $this->dbforge->add_key('logbook_relation_id', TRUE); + $this->dbforge->add_key('station_logbook_id', TRUE); + $this->dbforge->add_key('station_location_id', TRUE); + + $this->dbforge->create_table('station_logbooks_relationship'); + } + } + + public function down() + { + $this->dbforge->drop_table('station_logbooks_relationship'); + } +} \ No newline at end of file