# Is it ok to update external\_id on discourse database?

**URL:** <https://meta.discourse.org/t/is-it-ok-to-update-external-id-on-discourse-database/267592>\
**Category:** SSO\
**Created:** [June 7, 2023, 8:35pm UTC](https://meta.discourse.org/t/is-it-ok-to-update-external-id-on-discourse-database/267592 "2023-06-07T20:35:49Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Barrera](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicolas_barrera/32/287091_2.png) [@Nicolas\_Barrera](https://meta.discourse.org/u/Nicolas_Barrera)\
**Post date:** [June 7, 2023, 8:35pm UTC](https://meta.discourse.org/t/is-it-ok-to-update-external-id-on-discourse-database/267592/1 "2023-06-07T20:35:49Z")

</div>

I 've been searching the forum for info on updating external\_id on discourse db.

found this topic interesting:

> [@Is it possible to change users SSO's external\_id after a DB migration?](https://meta.discourse.org/t/is-it-possible-to-change-users-ssos-external-id-after-a-db-migration/62099):
>
> First I had issues with the external\_id field on SSO, because they were all initially strings of length 16, and later I stored 24chars strings, but it completely messed up, you could get logged under a different user, it seems it cropped the external\_id length, but that was hard to debug. So I make sure to keep external\_id with the same length, it’s not really practical, why not using a TEXT column type for it? And my question is also, can I update the external\_id of existing users, after doin…

Still I was interested in some insights regarding the implications of updating the external\_id on the database.

could I just issue an sql update and set the new correct `external_id`? can that bring any hidden problems? like if the user has a current open session or something else?

I got the users created through sso using an external\_id that’s the user’s account id on the external system. (I may need to model something else but it would be cool to be able to avoid changing the external system model at least for now)

the problem for me is that the person may have more than one account on the external system and can merge those accounts into one so sometimes depending on how he merges a new external\_id can come for the same user/email.

I am using the `require_activation` option so as I 've read on the mentioned topic I can’t delete the record and wait for it to be recreated.

thank you

---

_[View the full topic](https://meta.discourse.org/t/is-it-ok-to-update-external-id-on-discourse-database/267592)._
