aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Update/_1249.php
blob: 6d72c4de439efa2d443bd180575738853d0e51d3 (plain) (blame)
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
28
29
30
31
<?php

namespace Zotlabs\Update;

class _1249 {

	function run() {

		dbq("START TRANSACTION");

		if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
			$r1 = dbq("ALTER TABLE abook ADD abook_role TEXT NOT NULL DEFAULT ''");
			$r2 = dbq("CREATE INDEX \"abook_role\" ON abook (\"abook_role\")");
			$r = ($r1 && $r2);
		}
		else {
			$r = dbq("ALTER TABLE `abook` ADD `abook_role` CHAR(191) NOT NULL DEFAULT '' ,
				ADD INDEX `abook_role` (`abook_role`)");
		}

		if($r) {
			dbq("COMMIT");
			return UPDATE_SUCCESS;
		}

		dbq("ROLLBACK");
		return UPDATE_FAILED;

	}

}