From e79c1c45dcd23dde1f4b072993829cc008f4858b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 20 Sep 2015 16:01:28 +0200 Subject: Migration 16: Increase length of ci_session.ip_address for IPv6 Reported-by: Michael Mueller Signed-off-by: Florian Pritz --- application/migrations/016_allow_ipv6_storage.php | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 application/migrations/016_allow_ipv6_storage.php (limited to 'application/migrations/016_allow_ipv6_storage.php') diff --git a/application/migrations/016_allow_ipv6_storage.php b/application/migrations/016_allow_ipv6_storage.php new file mode 100644 index 000000000..726a18601 --- /dev/null +++ b/application/migrations/016_allow_ipv6_storage.php @@ -0,0 +1,27 @@ +db->dbprefix; + + if ($this->db->dbdriver == 'postgre') { + $this->db->query(' + ALTER TABLE "'.$prefix.'ci_sessions" + ALTER COLUMN "ip_address" type varchar(39); + '); + } else { + $this->db->query(' + ALTER TABLE `'.$prefix.'ci_sessions` + CHANGE `ip_address` `ip_address` varchar(39); + '); + } + } + + public function down() + { + throw new \exceptions\ApiException("migration/downgrade-not-supported", "downgrade not supported"); + } +} -- cgit v1.2.3-24-g4f1b