db update to add index to item.resource_id we query this in wikis a lot
This commit is contained in:
		
							
								
								
									
										2
									
								
								boot.php
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								boot.php
									
									
									
									
									
								
							| @@ -52,7 +52,7 @@ define ( 'PLATFORM_NAME',           'hubzilla' ); | |||||||
| define ( 'STD_VERSION',             '2.7.3' ); | define ( 'STD_VERSION',             '2.7.3' ); | ||||||
| define ( 'ZOT_REVISION',            '1.3' ); | define ( 'ZOT_REVISION',            '1.3' ); | ||||||
|  |  | ||||||
| define ( 'DB_UPDATE_VERSION',       1195  ); | define ( 'DB_UPDATE_VERSION',       1196  ); | ||||||
|  |  | ||||||
| define ( 'PROJECT_BASE',   __DIR__ ); | define ( 'PROJECT_BASE',   __DIR__ ); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -656,6 +656,7 @@ CREATE TABLE IF NOT EXISTS `item` ( | |||||||
|   KEY `aid` (`aid`), |   KEY `aid` (`aid`), | ||||||
|   KEY `owner_xchan` (`owner_xchan`), |   KEY `owner_xchan` (`owner_xchan`), | ||||||
|   KEY `author_xchan` (`author_xchan`), |   KEY `author_xchan` (`author_xchan`), | ||||||
|  |   KEY `resource_id` (`resource_id`), | ||||||
|   KEY `resource_type` (`resource_type`), |   KEY `resource_type` (`resource_type`), | ||||||
|   KEY `item_restrict` (`item_restrict`), |   KEY `item_restrict` (`item_restrict`), | ||||||
|   KEY `item_flags` (`item_flags`), |   KEY `item_flags` (`item_flags`), | ||||||
|   | |||||||
| @@ -627,6 +627,7 @@ create index "item_comments_closed" on item ("comments_closed"); | |||||||
| create index "item_aid" on item ("aid"); | create index "item_aid" on item ("aid"); | ||||||
| create index "item_owner_xchan" on item ("owner_xchan"); | create index "item_owner_xchan" on item ("owner_xchan"); | ||||||
| create index "item_author_xchan" on item ("author_xchan"); | create index "item_author_xchan" on item ("author_xchan"); | ||||||
|  | create index "item_resource_id" on item ("resource_id"); | ||||||
| create index "item_resource_type" on item ("resource_type"); | create index "item_resource_type" on item ("resource_type"); | ||||||
| create index "item_restrict" on item ("item_restrict"); | create index "item_restrict" on item ("item_restrict"); | ||||||
| create index "item_flags" on item ("item_flags"); | create index "item_flags" on item ("item_flags"); | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
| define( 'UPDATE_VERSION' , 1195 ); | define( 'UPDATE_VERSION' , 1196 ); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * |  * | ||||||
| @@ -3008,3 +3008,17 @@ function update_r1194() { | |||||||
|  |  | ||||||
| 	return UPDATE_SUCCESS; | 	return UPDATE_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function update_r1195() { | ||||||
|  |  | ||||||
|  | 	if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { | ||||||
|  | 		$r1 = q("CREATE INDEX item_resource_id ON item (resource_id)"); | ||||||
|  | 	} | ||||||
|  | 	else { | ||||||
|  | 		$r1 = q("ALTER TABLE item ADD INDEX (resource_id)"); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if($r1) | ||||||
|  | 		return UPDATE_SUCCESS; | ||||||
|  | 	return UPDATE_FAILED; | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user