1717use OCP \Migration \SimpleMigrationStep ;
1818
1919/**
20- * Recreate notifications_pushtoken(s) with a primary key for cluster support
20+ * Create database table to webpush support
2121 */
2222class Version6000Date20251112110000 extends SimpleMigrationStep {
23- public function __construct (
24- protected IDBConnection $ connection ,
25- ) {
26- }
2723
2824 /**
2925 * @param IOutput $output
@@ -38,7 +34,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3834
3935 if (!$ schema ->hasTable ('notifications_webpush ' )) {
4036 $ table = $ schema ->createTable ('notifications_webpush ' );
41- $ table ->addColumn ('id ' , Types::INTEGER , [
37+ $ table ->addColumn ('id ' , Types::BIGINT , [
4238 'autoincrement ' => true ,
4339 'notnull ' => true ,
4440 'length ' => 4 ,
@@ -48,9 +44,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4844 'notnull ' => true ,
4945 'length ' => 64 ,
5046 ]);
51- $ table ->addColumn ('token ' , Types::INTEGER , [
52- 'notnull ' => true ,
53- 'length ' => 4 ,
47+ $ table ->addColumn ('token ' , Types::BIGINT , [
5448 'default ' => 0 ,
5549 ]);
5650 $ table ->addColumn ('endpoint ' , Types::STRING , [
@@ -80,10 +74,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
8074
8175 $ table ->setPrimaryKey (['id ' ]);
8276 // Allow a single push subscription per device
83- $ table ->addUniqueIndex (['uid ' , 'token ' ], 'oc_npushwp_uid ' );
77+ $ table ->addUniqueIndex (['uid ' , 'token ' ], 'notifwebpush_uid_token ' );
8478 // If the push endpoint is removed, we will delete the row based on the endpoint
85- $ table ->addIndex (['endpoint ' ], 'oc_npushwp_endpoint ' );
79+ $ table ->addIndex (['endpoint ' ], 'notifwebpush_endpoint ' );
80+ return $ schema ;
8681 }
87- return $ schema ;
82+ return null ;
8883 }
8984}
0 commit comments