summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-09-20 16:01:28 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-09-20 16:01:28 +0200
commite79c1c45dcd23dde1f4b072993829cc008f4858b (patch)
treebc90956bccaad107255e350ed29cad242eede5cc /application
parent2e627d7a88aed82363a7ad48dab21b2b55797452 (diff)
Migration 16: Increase length of ci_session.ip_address for IPv6
Reported-by: Michael Mueller <michael.mueller@selfnet.de> Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/config/migration.php2
-rw-r--r--application/migrations/016_allow_ipv6_storage.php27
2 files changed, 28 insertions, 1 deletions
diff --git a/application/config/migration.php b/application/config/migration.php
index 7a5b5f970..d5cce76f9 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -21,7 +21,7 @@ $config['migration_enabled'] = true;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 15;
+$config['migration_version'] = 16;
/*
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 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Migration_allow_ipv6_storage extends CI_Migration {
+
+ public function up()
+ {
+ $prefix = $this->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");
+ }
+}