3 $table = new AlmanacNetwork();
4 $conn = $table->establishConnection('w');
8 'LOCK TABLES %T WRITE',
9 $table->getTableName());
12 foreach (new LiskMigrationIterator($table) as $network) {
13 $name = $network->getName();
15 // If this is the first copy of this row we've seen, mark it as seen and
17 if (empty($seen[$name])) {
22 // Otherwise, rename this row.
24 $new_name = $name.'-'.$seen[$name];
25 if (empty($seen[$new_name])) {
26 $network->setName($new_name);
30 } catch (AphrontDuplicateKeyQueryException
$ex) {
31 // New name is a dupe of a network we haven't seen yet.
41 'ALTER TABLE %T ADD UNIQUE KEY `key_name` (name)',
42 $table->getTableName());