File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- <?php namespace Database \Migrations ;
1+ <?php
2+ namespace Database \Migrations ;
23/**
34 * Copyright 2026 OpenStack Foundation
45 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +27,21 @@ final class Version20260424120000 extends AbstractMigration
2627{
2728 public function up (Schema $ schema ): void
2829 {
30+
31+ $ duplicates = (int ) $ this ->connection ->fetchOne (
32+ 'SELECT COUNT(*) FROM (
33+ SELECT 1
34+ FROM user_trusted_devices
35+ GROUP BY user_id, device_identifier
36+ HAVING COUNT(*) > 1
37+ ) dup '
38+ );
39+
40+ $ this ->abortIf (
41+ $ duplicates > 0 ,
42+ 'Duplicate trusted devices exist; dedupe user_trusted_devices before applying utd_user_device_uniq. '
43+ );
44+
2945 $ this ->addSql (
3046 'ALTER TABLE user_trusted_devices
3147 DROP INDEX utd_user_device_idx,
@@ -41,4 +57,4 @@ public function down(Schema $schema): void
4157 ADD INDEX utd_user_device_idx (user_id, device_identifier) '
4258 );
4359 }
44- }
60+ }
You can’t perform that action at this time.
0 commit comments