Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15412531
D21017.id50080.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21017.id50080.diff
View Options
diff --git a/resources/sql/autopatches/20200222.xident.01.migrate.php b/resources/sql/autopatches/20200222.xident.01.migrate.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20200222.xident.01.migrate.php
@@ -0,0 +1,40 @@
+<?php
+
+$account_table = new PhabricatorExternalAccount();
+$identifier_table = new PhabricatorExternalAccountIdentifier();
+
+$conn = $account_table->establishConnection('w');
+$table_name = $account_table->getTableName();
+
+$iterator = new LiskRawMigrationIterator($conn, $table_name);
+foreach ($iterator as $account_row) {
+ // We don't need to migrate "accountID" values for "password" accounts,
+ // since these were dummy values in the first place and are no longer
+ // read or written after D21014. (There would be no harm in writing these
+ // rows, but it's easy to skip them.)
+
+ if ($account_row['accountType'] === 'password') {
+ continue;
+ }
+
+ $account_id = $account_row['accountID'];
+ if (!strlen($account_id)) {
+ continue;
+ }
+
+ queryfx(
+ $conn,
+ 'INSERT IGNORE INTO %R (
+ phid, externalAccountPHID, providerConfigPHID,
+ identifierHash, identifierRaw,
+ dateCreated, dateModified)
+ VALUES (%s, %s, %s, %s, %s, %d, %d)',
+ $identifier_table,
+ $identifier_table->generatePHID(),
+ $account_row['phid'],
+ $account_row['providerConfigPHID'],
+ PhabricatorHash::digestForIndex($account_id),
+ $account_id,
+ $account_row['dateCreated'],
+ $account_row['dateModified']);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 1:31 PM (1 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389104
Default Alt Text
D21017.id50080.diff (1 KB)
Attached To
Mode
D21017: Migrate all "accountID" values to "ExternalAccountIdentifier" objects
Attached
Detach File
Event Timeline
Log In to Comment