diff options
-rw-r--r-- | application/config/migration.php | 2 | ||||
-rw-r--r-- | application/migrations/017_increase_password_length.php | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/application/config/migration.php b/application/config/migration.php index d5cce76f9..e96af5a41 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'] = 16; +$config['migration_version'] = 17; /* diff --git a/application/migrations/017_increase_password_length.php b/application/migrations/017_increase_password_length.php new file mode 100644 index 000000000..9d12d3f52 --- /dev/null +++ b/application/migrations/017_increase_password_length.php @@ -0,0 +1,27 @@ +<?php +defined('BASEPATH') OR exit('No direct script access allowed'); + +class Migration_increase_password_length extends CI_Migration { + + public function up() + { + $prefix = $this->db->dbprefix; + + if ($this->db->dbdriver == 'postgre') { + $this->db->query(' + ALTER TABLE "'.$prefix.'users" + ALTER COLUMN "password" type varchar(255); + '); + } else { + $this->db->query(' + ALTER TABLE `'.$prefix.'users` + CHANGE `password` `password` varchar(255); + '); + } + } + + public function down() + { + throw new \exceptions\ApiException("migration/downgrade-not-supported", "downgrade not supported"); + } +} |