summaryrefslogtreecommitdiffstats
path: root/application/migrations/017_increase_password_length.php
blob: 9d12d3f528e420842ccc2a2eb2b4fd6027de8e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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");
	}
}