Get rid of papertrail gem
As a second stage of deprecation warnings removal (see #1521) we should get rid of papertrail gem and use procedure introduced in auction app to store versions history.
Do you have it documented/planned somewhere whats the exact plan here ?
Well, atm it's a kind of a research, but I suppose it might be something like this:
-
[x] Add a trigger-based version storage to Contact model (this model and Domain as well were chosen to be first as they are most important/difficult to implement).
-
[x] Check locally/on staging if Contact versions saved/returned in admin UI well. For this we need to make changes via admin UI and via registrar ui. Success criteria - changes are saved in the model and in the audit table as well, changes are shown in index table/show page, search on changes works for main fields as already implemented, the person responsible for changed saved as well.
-
[x] Add a trigger-based version storage to Domain model.
-
[x] Check implementation of version saving on Domain model. Success criteria as per Contact model.
-
[x] Add trigger-based version storage to N models using papertrail gem atm.
-
[x] Check implementation for this models.
-
[x] Add a data migration to move papertrail gem versions history to new storage.
-
[ ] Remove unnecessary helpers & classes. Remove papertrail gem from project.
Old tables with version data... well, I prefer not to touch them, at least for now, just in case.
Domain history: example domain: timo-9k2.ee
https://st-adm.infra.tld.ee/admin/domains/86934/domain_versions history view has 3 records - should be 2 - 1. and 3. are double. 2. record is the domain.create record. For some reason the action assoctiated with the 2. record is pending - do not know why?.
https://st-adm.infra.tld.ee/admin/domain_versions/566509 pure history view has 2 records as expected. The first record type should be create instead of insert to match epp transfrom requests. Update record is missing the user responsible for the change.
https://st-adm.infra.tld.ee/admin/domains/86975/domain_versions
- it looks like upon domain creation two records are created in history pending and insert, but surprisingly there is 2 hr time difference between these records - pending seems to be in utc timezone and insert in local timezone.
- updating child object still does not appear as a change in domain data - no new record is created, but the updated data is available on the preexisting pending record. Also after the next domain update history still displayed expired contact data.
- admin contact is blank in history view. Updated tech contact data for the registration and suddenly all contacts are double (first the updated registrant contact and second the initial version of it) in history view but tech contact is not replaced
PS there are some special cases of update we should differentiate according to EPP - transfer, renew and delete. Delete means in this case the initiation of delete process that ends with a record being deleted from the table of active registrations and archived in log_domains table. Delete is in pending state for 30 days in .ee case after delete request and before being actually deleted.
https://st-adm.infra.tld.ee/admin/domains/86934/domain_versions history view has 3 records - should be 2 - 1. and 3. are double.
Yep, that's from the view logic. Record 1 is the last(current) state.
- record is the domain.create record. For some reason the action assoctiated with the 2. record is pending - do not know why?
Don't know either, that's again from the view logic - mark as 'pending' actions where object isn't persisted yet.
https://st-adm.infra.tld.ee/admin/domain_versions/566509 pure history view has 2 records as expected. The first record type should be create instead of insert to match epp transfrom requests.
ATM we are do not know anything about epp transform requests in history, because it's made on a DB level by a DB tools. We might save it in some model field in order to have it in the history.
Update record is missing the user responsible for the change.
Fixed.
current situation:
2.1 contacts in the first record are presented incorrectly. Two examples: request: https://st-adm.infra.tld.ee/admin/epp_logs/3033 - same contact as registrant and admin, tech left blank meaning that registrant was assigned to that role as well https://st-adm.infra.tld.ee/admin/domains/86976 But the history shows data only in registrant and tech columns and both have double entries https://st-adm.infra.tld.ee/admin/domains/86976/domain_versions https://st-adm.infra.tld.ee/admin/domain_versions/596166
now entered different contact for all the roles https://st-adm.infra.tld.ee/admin/epp_logs/3041 now history shows only registrant info and again double https://st-adm.infra.tld.ee/admin/domains/86977/domain_versions https://st-adm.infra.tld.ee/admin/domain_versions/596167
2.2 Update of phone nr to Timo Ajalugu resulted in no new history records for the associated domain object, but the changed data was there in on of the double entries of contact columns. But no sign of any change is present in case the the contact updated was missing in the initial record https://st-adm.infra.tld.ee/admin/epp_logs/3069 https://st-adm.infra.tld.ee/admin/domains/86977/domain_versions
17.04.2020
- Registered a domain with single contact in each role. Everuything looks fine in history. Now replaced tech contact of the domain, in history new record was created, but the tech contact is still the same
now replaced admin contact. Again new record was added to the history New record has new tech contact from the previous change, but admin contact is still the same. Instead new admin contact appears in the initial record
then replaced registrant. And this time new record has all the contacts correct.
https://st-adm.infra.tld.ee/admin/domains/86980/domain_versions
- Added nameserver records to an inactive domain. New record was created in history but both new and old have now the host records associated
now added third record to the domain and changed the ip address of the glue record from previous update and as a result newly created record has no hosts, record from previous change was updated with the current state and the initial record is lacking the new and updated record but untouched record is still there
https://st-adm.infra.tld.ee/admin/domains/86979/domain_versions
dns keys seem to act identically to hosts
https://st-adm.infra.tld.ee/admin/domains/86978/domain_versions
- Transfer of a domain to another registrar. New record was created and everything related to the change it self looked OK, but the initial record had for some reason incomplete data for regsitrant and admin contacts. After the chage admin contact data was completed for new and initial record, but registrant data is still incomplete for the first record (all new contact obects were created in the process of registrar transfer)
https://st-adm.infra.tld.ee/admin/domains/86977/domain_versions
- Changed data of a child object (registrant phone nr) - no new record was created to the domain history view but the data changed for all the domains and history records where this contact objects was present
https://st-adm.infra.tld.ee/admin/domains/86981/domain_versions https://st-adm.infra.tld.ee/admin/contact_versions/6153656