# Check validity of existing records

**URL:** https://discuss.tryton.org/t/check-validity-of-existing-records/3422
**Category:** Ideas
**Created:** [October 30, 2020, 5:10pm UTC](https://discuss.tryton.org/t/check-validity-of-existing-records/3422 "2020-10-30T17:10:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 30, 2020, 5:10pm UTC](https://discuss.tryton.org/t/check-validity-of-existing-records/3422/1 "2020-10-30T17:10:53Z")

</div>

When we update a database to a new Tryton version, it may happen that the new version added new checks or constraints on some models, e.g. the phone number validation of contact mechanism.  
It is then required to the user to fix to fix the wrong data. But it can be difficult to find those failing records.  
I propose to add on `trytond-admin` an option to execute validate on existing records. There should be an option to define which the model names (all if empty) and another option to define the percentage of records to test (all if empty). The command will report the ID, record name and validation error for each record that is failing.

What do you think?

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [October 30, 2020, 5:48pm UTC](https://discuss.tryton.org/t/check-validity-of-existing-records/3422/2 "2020-10-30T17:48:19Z")

</div>

I like the idea but there should probably a mechanism that later eases end users to apply a filter that shows those records.

So I wonder if it should not be a tool in the Administration section.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 30, 2020, 6:18pm UTC](https://discuss.tryton.org/t/check-validity-of-existing-records/3422/3 "2020-10-30T18:18:36Z")

</div>

I do not think you should run this on production database.  
For me it is a tool used during the migration to prepare the existing data.

---

<div class="post-metadata">

### Author: ![yangoon](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/y/67e7ee/32.png) [@yangoon](https://discuss.tryton.org/u/yangoon)
#### Post date: [October 30, 2020, 10:22pm UTC](https://discuss.tryton.org/t/check-validity-of-existing-records/3422/4 "2020-10-30T22:22:27Z")

</div>

Sounds really useful! +1
