aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Update/_1257.php
blob: 34c10c3729e7e4422e82067558aeca900f923880 (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
32
33
<?php

namespace Zotlabs\Update;

class _1257 {

	function run() {

		dbq("START TRANSACTION");

		$r1 = dbq("TRUNCATE TABLE updates");

		if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
			$r2 = dbq("ALTER TABLE updates add ud_host text NOT NULL DEFAULT ''");
		}

		if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
			$r2 = dbq("ALTER TABLE updates add ud_host varchar(191) NOT NULL DEFAULT ''");
		}

		$r3 = dbq("ALTER TABLE updates DROP COLUMN ud_guid");

		if($r1 && $r2 && $r3) {
			dbq("COMMIT");
			return UPDATE_SUCCESS;
		}

		q("ROLLBACK");
		return UPDATE_FAILED;

	}

}