| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | declare(strict_types=1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Nextcloud - Social Support | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is licensed under the Affero General Public License version 3 or | 
					
						
							|  |  |  |  * later. See the COPYING file. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @author Maxence Lange <maxence@artificial-owl.com> | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  |  * @copyright 2022, Maxence Lange <maxence@artificial-owl.com> | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  |  * @license GNU AGPL version 3 or any later version | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  |  * published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  |  * License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace OCA\Social\Migration; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Closure; | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | use Doctrine\DBAL\Schema\SchemaException; | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | use OCP\DB\ISchemaWrapper; | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | use OCP\DB\Types; | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | use OCP\Migration\IOutput; | 
					
						
							|  |  |  | use OCP\Migration\SimpleMigrationStep; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | class Version1000Date20221118000001 extends SimpleMigrationStep { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param IOutput $output | 
					
						
							|  |  |  | 	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | 
					
						
							|  |  |  | 	 * @param array $options | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * @return ISchemaWrapper | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		/** @var ISchemaWrapper $schema */ | 
					
						
							|  |  |  | 		$schema = $schemaClosure(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$this->createActions($schema); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$this->createActors($schema); | 
					
						
							|  |  |  | 		$this->createCacheActors($schema); | 
					
						
							|  |  |  | 		$this->createCacheDocuments($schema); | 
					
						
							| 
									
										
										
										
											2020-09-21 15:46:35 +00:00
										 |  |  | 		$this->createClient($schema); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$this->createFollows($schema); | 
					
						
							|  |  |  | 		$this->createHashtags($schema); | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 		$this->createInstance($schema); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$this->createRequestQueue($schema); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$this->createStreams($schema); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$this->createStreamActions($schema); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$this->createStreamDest($schema); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$this->createStreamQueue($schema); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$this->createStreamTags($schema); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		return $schema; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createActions(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_action')) { | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_action'); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id_prim']); | 
					
						
							|  |  |  | 		$table->addUniqueIndex(['actor_id_prim', 'object_id_prim', 'type'], 'aot'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createActors(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_actor')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_actor'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'user_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'preferred_username', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'name', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'summary', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'public_key', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'private_key', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'avatar_version', Types::INTEGER, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 2, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id_prim']); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createFollows(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_follow')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_follow'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'follow_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'follow_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'accepted', Types::BOOLEAN, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'default' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id_prim']); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addUniqueIndex(['accepted', 'follow_id_prim', 'object_id_prim', 'actor_id_prim'], 'afoa'); | 
					
						
							|  |  |  | 		$table->addUniqueIndex(['accepted', 'object_id_prim', 'actor_id_prim'], 'aoa'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createHashtags(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_hashtag')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_hashtag'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'hashtag', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'trend', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['hashtag']); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createInstance(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_instance')) { | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_instance'); | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'local', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'length' => 1, | 
					
						
							|  |  |  | 				'default' => 0, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'unsigned' => true | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'uri', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'title', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'version', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'short_description', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'description', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'email', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'urls', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '[]' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stats', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '[]' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'usage', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '[]' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'image', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'languages', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '[]' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'contact', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'account_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2020-09-01 14:14:19 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['uri']); | 
					
						
							|  |  |  | 		$table->addIndex(['local', 'uri', 'account_prim']); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createStreams(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_stream')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_stream'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-02 02:59:06 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'nid', Types::BIGINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'length' => 20, | 
					
						
							|  |  |  | 				'unsigned' => true | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-07-31 13:21:59 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-07-31 13:21:59 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2020-07-31 13:21:59 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'subtype', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'to', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'to_array', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'cc', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'bcc', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'content', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'summary', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'published', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'published_time', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'attributed_to', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'attributed_to_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'in_reply_to', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'in_reply_to_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'activity_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'object_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'hashtags', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'details', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'source', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'instances', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'attachments', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'cache', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'local', Types::BOOLEAN, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'filter_duplicate', Types::BOOLEAN, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table->setPrimaryKey(['nid']); | 
					
						
							| 
									
										
										
										
											2020-10-01 14:29:43 +00:00
										 |  |  | 		$table->addUniqueIndex(['id_prim']); | 
					
						
							| 
									
										
										
										
											2020-09-02 02:59:06 +00:00
										 |  |  | 		$table->addUniqueIndex(['nid']); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addUniqueIndex( | 
					
						
							|  |  |  | 			[ | 
					
						
							|  |  |  | 				'id_prim', | 
					
						
							|  |  |  | 				'published_time', | 
					
						
							|  |  |  | 				'object_id_prim', | 
					
						
							|  |  |  | 				'filter_duplicate', | 
					
						
							|  |  |  | 				'attributed_to_prim' | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 			'ipoha' | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addIndex(['object_id_prim'], 'object_id_prim'); | 
					
						
							|  |  |  | 		$table->addIndex(['in_reply_to_prim'], 'in_reply_to_prim'); | 
					
						
							|  |  |  | 		$table->addIndex(['attributed_to_prim'], 'attributed_to_prim'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createCacheActors(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_cache_actor')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_cache_actor'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'account', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'local', Types::BOOLEAN, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'default' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'following', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'followers', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'inbox', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'shared_inbox', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'outbox', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'featured', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'url', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'preferred_username', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'name', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'icon_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'summary', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'public_key', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'source', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'details', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2019-06-02 11:43:18 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table->setPrimaryKey(['id_prim']); | 
					
						
							| 
									
										
										
										
											2020-10-01 14:29:43 +00:00
										 |  |  | 		$table->addUniqueIndex(['id_prim']); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createCacheDocuments(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_cache_doc')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_cache_doc'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'parent_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '', | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'media_type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '', | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'mime_type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'url', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'local_copy', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'resized_copy', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'public', Types::BOOLEAN, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'error', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 1, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'caching', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id_prim']); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-09-21 15:46:35 +00:00
										 |  |  | 	private function createClient(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_client')) { | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_client'); | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::INTEGER, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'autoincrement' => true, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'length' => 7, | 
					
						
							|  |  |  | 				'unsigned' => true, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_name', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_website', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_redirect_uris', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_client_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_client_secret', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'app_scopes', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-09-18 11:55:47 +00:00
										 |  |  | 				'notnull' => false | 
					
						
							| 
									
										
										
										
											2020-08-25 03:06:43 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'auth_scopes', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'auth_account', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'auth_user_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'auth_code', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'token', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 				'default' => '' | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'last_update', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'creation', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id']); | 
					
						
							| 
									
										
										
										
											2020-09-18 11:55:47 +00:00
										 |  |  | 		$table->addUniqueIndex(['auth_code', 'token', 'app_client_id', 'app_client_secret']); | 
					
						
							| 
									
										
										
										
											2020-08-28 02:35:57 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createRequestQueue(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_req_queue')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_req_queue'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::BIGINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'autoincrement' => true, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'length' => 11, | 
					
						
							|  |  |  | 				'unsigned' => true, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'token', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'author', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'activity', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'instance', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'priority', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 1, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => 0, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'status', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 1, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => 0, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'tries', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 2, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => 0, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'last', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id']); | 
					
						
							| 
									
										
										
										
											2022-11-23 12:40:06 +00:00
										 |  |  | 		$table->addIndex(['token']); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createStreamActions(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_stream_act')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_stream_act'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'id', Types::INTEGER, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'autoincrement' => true, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'length' => 11, | 
					
						
							|  |  |  | 				'unsigned' => true | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-07-31 13:21:59 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stream_id', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stream_id_prim', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table->addColumn('liked', Types::BOOLEAN, ['default' => false]); | 
					
						
							|  |  |  | 		$table->addColumn('boosted', Types::BOOLEAN, ['default' => false]); | 
					
						
							|  |  |  | 		$table->addColumn('replied', Types::BOOLEAN, ['default' => false]); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-04-14 13:56:20 +00:00
										 |  |  | 			'values', Types::TEXT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id']); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addUniqueIndex(['stream_id_prim', 'actor_id_prim'], 'sa'); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createStreamDest(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_stream_dest')) { | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_stream_dest'); | 
					
						
							| 
									
										
										
										
											2020-07-31 13:21:59 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stream_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'actor_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 15, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'subtype', Types::STRING, | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 7, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		$table->addUniqueIndex(['stream_id', 'actor_id', 'type'], 'sat'); | 
					
						
							|  |  |  | 		$table->addIndex(['type', 'subtype'], 'ts'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 	 * | 
					
						
							|  |  |  | 	 * @throws SchemaException | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	private function createStreamQueue(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_stream_queue')) { | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_stream_queue'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'id', Types::BIGINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'autoincrement' => true, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'notnull' => true, | 
					
						
							|  |  |  | 				'length' => 11, | 
					
						
							|  |  |  | 				'unsigned' => true, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'token', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 63 | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stream_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 255, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'type', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 31, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'status', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 1, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => 0, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'tries', Types::SMALLINT, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 2, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 				'default' => 0, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'last', Types::DATETIME, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							|  |  |  | 				'notnull' => false, | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		$table->setPrimaryKey(['id']); | 
					
						
							| 
									
										
										
										
											2022-11-23 12:40:06 +00:00
										 |  |  | 		$table->addIndex(['token']); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param ISchemaWrapper $schema | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 	private function createStreamTags(ISchemaWrapper $schema) { | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		if ($schema->hasTable('social_stream_tag')) { | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 		$table = $schema->createTable('social_stream_tag'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'stream_id', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-11-22 23:16:36 +00:00
										 |  |  | 				'length' => 32, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addColumn( | 
					
						
							| 
									
										
										
										
											2022-11-18 15:31:53 +00:00
										 |  |  | 			'hashtag', Types::STRING, | 
					
						
							| 
									
										
										
										
											2019-06-02 12:08:15 +00:00
										 |  |  | 			[ | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 				'notnull' => false, | 
					
						
							| 
									
										
										
										
											2022-04-15 11:34:01 +00:00
										 |  |  | 				'length' => 127, | 
					
						
							| 
									
										
										
										
											2020-06-23 12:11:49 +00:00
										 |  |  | 				'default' => '' | 
					
						
							| 
									
										
										
										
											2019-06-02 12:08:15 +00:00
										 |  |  | 			] | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-12 12:35:33 +00:00
										 |  |  | 		$table->addUniqueIndex(['stream_id', 'hashtag'], 'sh'); | 
					
						
							| 
									
										
										
										
											2019-05-07 15:11:04 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |