254 lines
7.9 KiB
Plaintext
254 lines
7.9 KiB
Plaintext
scripts ran to fix
|
|
|
|
|
|
DUPLICATES
|
|
|
|
script to find the duplicates:
|
|
|
|
select AID, count(*)
|
|
from ACLIENT
|
|
group by AID
|
|
having count(*) > 1
|
|
|
|
|
|
Script to fix the duplicates:
|
|
|
|
set rowcount 1
|
|
delete from
|
|
_TABLENAMEHERE_
|
|
where
|
|
aid='_RECORDIDHERE_'
|
|
|
|
This script was used to fix all the problems noted in duplicates section except for AADDRESS
|
|
|
|
Note set Rowcount should be the total number of duplicates minus 1. All records I found were duplicated once only for a total of two identical records, with the single exception of
|
|
a record in the usermru noted below so rowcount needed to be changed to 2 for that record only. If it's set to 2 and there is actually only two copies then all would be lost so this
|
|
setting is critical.
|
|
|
|
|
|
|
|
For addresses used this query to find them:
|
|
select AROOTOBJECTID, AADDRESSTYPE, count(*)
|
|
from AADDRESS
|
|
group by AROOTOBJECTID, AADDRESSTYPE
|
|
having count(*) > 1
|
|
But did not fix them at all, there were dupes.
|
|
|
|
MESSED UP CLIENT RECORD
|
|
delete from aclient where aid='06000100-0400-14BE-0000-0100070004BE'
|
|
|
|
|
|
CREATED CLIENT "_AyaNova_Support_Created_Client_"
|
|
ID: 1291D0C1-2BB4-4A2D-8493-2375EA523E56
|
|
Used to rescue orphaned records
|
|
63 workorders
|
|
|
|
|
|
Query to find orphaned records:
|
|
select AWORKORDER.AID as WorkorderId, ACLIENT.AID as ClientId from aworkorder
|
|
left join aclient on aworkorder.aclientid = aclient.aid
|
|
where aclient.aid is null
|
|
|
|
Query to fix:
|
|
update aworkorder set aworkorder.aclientid = '1291D0C1-2BB4-4A2D-8493-2375EA523E56'
|
|
from aworkorder
|
|
left join aclient on aworkorder.aclientid = aclient.aid
|
|
where aclient.aid is null
|
|
|
|
|
|
Corrupted repport:
|
|
delete from areport where aid='a904be6a-c6b6-45f8-aaf1-fe26ab03728b'
|
|
|
|
|
|
|
|
|
|
Orphaned units query:
|
|
select * from aunit
|
|
left join aclient on aunit.aclientid = aclient.aid
|
|
where aclient.aid is null
|
|
|
|
fix:
|
|
update aworkorder set aworkorder.aclientid = '1291D0C1-2BB4-4A2D-8493-2375EA523E56'
|
|
from aworkorder
|
|
left join aclient on aworkorder.aclientid = aclient.aid
|
|
where aclient.aid is null
|
|
|
|
|
|
|
|
RESTORE PRIMARY KEY QUERY
|
|
ALTER TABLE aclient ADD CONSTRAINT PK_Client_AID PRIMARY KEY CLUSTERED (AID);
|
|
|
|
|
|
CREATED VENDOR "_AyaNova_support....etc"
|
|
B17CAFAF-B3D3-44E6-B21F-B1D656D5AED6
|
|
|
|
CREATED PART
|
|
D2DE6640-2194-4F71-96A5-FB0FA6081448
|
|
|
|
CREATED UNITMODEL
|
|
62A476A2-FA92-4A1C-8F43-C24254FEB783
|
|
|
|
|
|
|
|
******* DUPLICATES *********
|
|
(# - indicates fixed)
|
|
|
|
Clients
|
|
=======
|
|
none
|
|
|
|
Units
|
|
=====
|
|
# 8F8C0544-4CC7-4536-A73C-B88FBFEAC024 2
|
|
|
|
|
|
HeadOffice
|
|
==========
|
|
AID (No column name)
|
|
# A708436C-4D3B-4F0F-BD6B-681CD2DC7F6C 2
|
|
# 00EB0103-35E1-4E4C-9BA9-7662C496F85A 2
|
|
|
|
|
|
AADDRESS TODO: Not fixed yet, time ran out
|
|
========
|
|
|
|
|
|
NOTE: to fix this should check for no matching root object ID then delete
|
|
|
|
AROOTOBJECTID AADDRESSTYPE (No column name)
|
|
C33BED9F-279A-48C9-9F99-03202DB5759F 1 2
|
|
526E65D5-0E04-4573-8CF6-8A1AE94E1903 1 2
|
|
3A440D46-7C19-46F8-94BF-E9368DD16DED 1 2
|
|
72760FAF-B6F2-4788-BD3F-94FC6AC33637 1 2
|
|
A4674CE1-ED73-415A-8EE2-21AEDB794ED3 1 2
|
|
3A440D46-7C19-46F8-94BF-E9368DD16DED 2 2
|
|
E2B49271-9483-4C13-AD58-170687B09AEE 1 2
|
|
D113AEAC-7CAB-433E-BFF8-C4A6B2BC782B 1 2
|
|
F5388A5B-24CC-4AA0-B5D2-C0D76C766AD8 2 2
|
|
A534912D-BE3B-449F-AE95-6F6C6D7D5630 1 2
|
|
A708436C-4D3B-4F0F-BD6B-681CD2DC7F6C 1 2
|
|
D2D7A5CE-C1C3-4570-835E-65F82EA13D55 1 2
|
|
05778884-8C3B-4F16-97E4-9E309A3E3945 1 2
|
|
9A5C75C5-A668-45BC-8F8D-50BCA1D05BB6 1 2
|
|
A4674CE1-ED73-415A-8EE2-21AEDB794ED3 2 2
|
|
ED5258B6-B5FD-4A86-B58E-82AB038969E3 2 2
|
|
F5388A5B-24CC-4AA0-B5D2-C0D76C766AD8 1 2
|
|
676E9FB2-7590-4584-B8FE-46F8EA719E60 1 2
|
|
|
|
|
|
ANOTIFYEVENT ** TODO: not investigated or fixed yet
|
|
============
|
|
|
|
**TODO** MORE INVESTIGATION LATER
|
|
|
|
There is some sketchiness here, specifically old events at least one from 2013 and weird dates like 2100 etc
|
|
Also need to check that the ID's are matched to real objects being notified on an not deleted ones.
|
|
|
|
|
|
ANOTIFYPOPUP
|
|
===========
|
|
Some old events in there with delivery dates from 2013, nothing sketchy looking though, probably older users who no longer login so don't get the delivery
|
|
|
|
APART
|
|
=====
|
|
AID (No column name)
|
|
# 179675CD-08EC-4BF6-A130-3CB98F7B57DC 2
|
|
# 085A9044-FED8-4FAD-BE2D-AB76ACA094F1 2
|
|
|
|
|
|
|
|
AREPORT
|
|
=======
|
|
AID (No column name)
|
|
# 56967B3C-F035-4E2A-8EDC-30B95D038BED 2
|
|
# B52F93C9-9422-4BE9-8A5A-4EEAE475E2AC 2
|
|
# 8356D964-C57C-4579-8E99-B13B5B361C2A 2
|
|
# 0EF1626F-25B2-4A06-92BE-CD235FF6D4BC 2
|
|
|
|
|
|
AUSERMRU
|
|
========
|
|
AID (No column name)
|
|
# A69CD31E-06F8-48C8-A390-03DF3E99C5D0 2
|
|
# E90FA108-F993-4982-8F68-3581EC5A02F2 2
|
|
# 2ABC2E5D-153D-4DC7-B547-61C8669B2B5A 2
|
|
# D6A13C85-AB3F-4C94-864C-7DCC1CCDBA53 3
|
|
# 4F31C822-19EA-4007-9240-9AFB7E45353B 2
|
|
# 9964772C-E17D-4139-BA98-C78CA752549C 2
|
|
# 8D9EE060-75A3-4825-8D86-E1FBF4149AC4 2
|
|
|
|
|
|
aworkoderitem
|
|
=============
|
|
AID (No column name)
|
|
# B8496034-2BD9-4E06-AC75-44DF49D3ACC9 2
|
|
|
|
|
|
aworkorderitemlabor
|
|
===================
|
|
# 2E23C692-7B04-4931-8EE8-BE01966B5764 2
|
|
|
|
aworkorderquote
|
|
===============
|
|
AID (No column name)
|
|
# CB7AE34A-A6F6-40DE-BCAD-6E7B5E81D5F9 2
|
|
|
|
|
|
|
|
****** ORPHANED RECORDS ******
|
|
WORKORDERS
|
|
63 workorders found orpphaned
|
|
|
|
Set them all to a special client created for orphaned records "_AyaNova_Support_Created_Client_"
|
|
|
|
One was a PM number 1091 which looked ok but I set it to inactive anyway just to be safe.
|
|
FOur are quotes and 48 are workorders.
|
|
|
|
Just filter by the special client name to see them.
|
|
|
|
|
|
UNITS
|
|
36 orphaned units were found with no client and were set to the special client created by support. These should be edited by hand and set back to the correct client wherever possible.
|
|
Again, filter by special client name to see them.
|
|
|
|
There may be others, I only hit the most important tables with client references given the time constraints
|
|
|
|
|
|
|
|
*** SKETCHY LOOKING REPORT RECORDS ***
|
|
Two reports seem sketchy looking at the DB table for them, it appears they have no content, that might just mean they are not edited yet, not sure but fwiw here are the names:
|
|
"Sample Dispatching Report with API bringing in Unit's Custom0 Custom1 fields"
|
|
And
|
|
"FOUR ALARM - Dispatching Report - EXTINGUISHER ONLY"
|
|
|
|
|
|
***** TABLES WITH PRIMARY KEYS MISSING ******
|
|
ACLIENT
|
|
|
|
|
|
|
|
****** Reported problems ******
|
|
|
|
Unit screen, opening unit detail for "389806" showed no menu bar, worked here after fixes, but may be related more to needing to clear menu options (ctrl-start after login) as it looked ok with admin account logged in. So either it was fixed by removing duplicates or it's a single user issue with their saved form settings and they can reset through the UI.
|
|
|
|
Client that can't be deleted: No specific client was mentioned but there was a passing mention in an earlier email about client 59f9d90-33b8-47e6-89ac-d9a8440d750a possibly being corrupted.
|
|
That client ID seems invalid, but I did find a client (ID: 06000100-0400-14BE-0000-0100070004BE) with no name at all and some bizzarre data in teh wrong places which was set inactive.
|
|
Checked and it's not tied to any workorders of any type and no units so I deleted it. It may be tied into other stuff but I only checked the most important ones as I will be checking records in critical tables against possible missing clients anyway.
|
|
|
|
REPORT CORRUPT: The report "FOUR ALARM - Detailed Workorder Billing Copy" with ID a904be6a-c6b6-45f8-aaf1-fe26ab03728b was found to be corrupt as reported and is not fixable so was removed.
|
|
|
|
|
|
========================
|
|
PROBLEMS FOUND RESTORING INDEXES
|
|
|
|
Too many missing keys to document, almost every table. Also many many orphaned records, where possible I replaced the orphaned link with a fresh record so users can fix, in some cases that wasn't possible so cleaned up as best as can.
|
|
|
|
One standout though is the workorderitempart table which had 403 links to parts that no longer exist, replaced all those links to the _AyaNova_support...part so that can easily be spotted.
|
|
|
|
|
|
APURCHASEORDERITEM RECORD 8283108B-D4D1-4159-B5EC-1F1C6C1CDEBF IS LINKED TO A MISSING AWORKORDERITEMPARTREQUEST RECORD. Since there is no way to restore this properly I just set it to null, it's closed anyway.
|
|
|
|
|
|
|
|
|