summaryrefslogtreecommitdiffstats
path: root/application/migrations
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-03-29 00:21:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-03-29 00:21:49 +0200
commita47379cb313f5966ee1e783a0357860b7d4ba400 (patch)
tree0ad810d1513b49ccd50ba5fd86fec9ac8a114d08 /application/migrations
parent6a149250ae8fb159d5c8f40314b222c1c4ab1abf (diff)
Increase size of password field in DB
The php documentation for password_hash recommends 255. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/migrations')
-rw-r--r--application/migrations/017_increase_password_length.php27
1 files changed, 27 insertions, 0 deletions
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");
+ }
+}