# Some useful SQL to look into upgrades

**URL:** <https://forum.communityhealthtoolkit.org/t/some-useful-sql-to-look-into-upgrades/2112>\
**Category:** Technical Support\
**Tags:** data, upgrades\
**Created:** [August 22, 2022, 9:11pm UTC](https://forum.communityhealthtoolkit.org/t/some-useful-sql-to-look-into-upgrades/2112 "2022-08-22T21:11:52Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![michael](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/michael/32/319_2.png) [@michael](https://forum.communityhealthtoolkit.org/u/michael)\
**Post date:** [July 10, 2023, 8:31pm UTC](https://forum.communityhealthtoolkit.org/t/some-useful-sql-to-look-into-upgrades/2112/5 "2023-07-10T20:31:56Z")

</div>

As of [4.0.0](https://docs.communityhealthtoolkit.org/core/releases/4.0.0/), upgrades are no longer tracked the same way. See [this post](https://forum.communityhealthtoolkit.org/t/understanding-when-cht-core-upgrades-occur-via-horti-upgrade-documents/2682) for more details.

If you have the `couchdb_medic_logs` table in PostgreSQL, you can use this SQL to see the upgrade history.

```auto
SELECT
	(doc #>> '{to,time}')::date AS date,
	doc #>> '{to,version}' AS version
FROM
	couchdb_medic_logs

WHERE
	doc->>'_id' LIKE 'upgrade_log%';

```

---

_[View the full topic](https://forum.communityhealthtoolkit.org/t/some-useful-sql-to-look-into-upgrades/2112)._
