-
Notifications
You must be signed in to change notification settings - Fork 0
/
tablediff.sh
executable file
·103 lines (97 loc) · 3.79 KB
/
tablediff.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/local/bin/bash
# This requires bash > 4.0 for the associative array
set -eo pipefail
foreach() {
arr="$(declare -p $1)" ; eval "declare -A f="${arr#*=};
for i in ${!f[@]}; do $2 "$i" "${f[$i]}"; done
}
schemadiff() {
psql -d sdetest -t -A -F"," -c "SELECT * FROM \"$1\" ORDER BY \"$2\"" > /tmp/diffs/$1.sdetest.csv
psql -d sdeyaml -t -A -F"," -c "SELECT * FROM \"$1\" ORDER BY \"$2\"" > /tmp/diffs/$1.sdeyaml.csv
}
declare -A tables=(
[agtAgents]="agentID"
[agtAgentTypes]="agentTypeID"
[agtResearchAgents]="agentID\",\"typeID"
[certCerts]="certID"
[chrAncestries]="ancestryID"
[chrAttributes]="attributeID"
[chrBloodlines]="bloodlineID"
[chrFactions]="factionID"
[chrRaces]="raceID"
[crpActivities]="activityID"
[crpNPCCorporationDivisions]="corporationID\",\"divisionID"
[crpNPCCorporationResearchFields]="skillID\",\"corporationID"
[crpNPCCorporations]="corporationID"
[crpNPCCorporationTrades]="corporationID\",\"typeID"
[crpNPCDivisions]="divisionID"
[dgmAttributeCategories]="categoryID"
[dgmAttributeTypes]="attributeID"
[dgmEffects]="effectID"
[dgmExpressions]="expressionID"
[dgmTypeAttributes]="typeID\",\"attributeID"
[dgmTypeEffects]="typeID\",\"effectID"
[eveGraphics]="graphicID"
[eveIcons]="iconID"
[eveUnits]="unitID"
[industryActivity]="typeID\",\"activityID"
[industryBlueprints]="typeID"
[invCategories]="categoryID"
[invContrabandTypes]="factionID\",\"typeID"
[invControlTowerResourcePurposes]="purpose"
[invControlTowerResources]="controlTowerTypeID\",\"resourceTypeID"
[invFlags]="flagID"
[invGroups]="groupID"
[invItems]="itemID"
[invMarketGroups]="marketGroupID"
[invMetaGroups]="metaGroupID"
[invMetaTypes]="typeID"
[invNames]="itemID"
[invPositions]="itemID"
[invTraits]="traitID"
[invTypeMaterials]="typeID\",\"materialTypeID"
[invTypeReactions]="reactionTypeID\",\"input\",\"typeID"
[invTypes]="typeID"
[invUniqueNames]="itemID"
[invVolumes]="typeID"
[mapCelestialStatistics]="celestialID"
[mapConstellationJumps]="fromConstellationID\",\"toConstellationID"
[mapConstellations]="constellationID"
[mapDenormalize]="itemID"
[mapJumps]="stargateID"
[mapLandmarks]="landmarkID"
[mapLocationScenes]="locationID"
[mapLocationWormholeClasses]="locationID"
[mapRegionJumps]="fromRegionID\",\"toRegionID"
[mapRegions]="regionID"
[mapSolarSystemJumps]="fromSolarSystemID\",\"toSolarSystemID"
[mapSolarSystems]="solarSystemID"
[mapUniverse]="universeID"
[planetSchematics]="schematicID"
[planetSchematicsPinMap]="schematicID\",\"pinTypeID"
[planetSchematicsTypeMap]="schematicID\",\"typeID"
[ramActivities]="activityID"
[ramAssemblyLineStations]="stationID\",\"assemblyLineTypeID"
[ramAssemblyLineTypeDetailPerCategory]="assemblyLineTypeID\",\"categoryID"
[ramAssemblyLineTypeDetailPerGroup]="assemblyLineTypeID\",\"groupID"
[ramAssemblyLineTypes]="assemblyLineTypeID"
[ramInstallationTypeContents]="installationTypeID\",\"assemblyLineTypeID"
[skinLicense]="licenseTypeID"
[skinMaterials]="skinMaterialID"
[skins]="skinID"
[staOperations]="operationID"
[staOperationServices]="operationID\",\"serviceID"
[staServices]="serviceID"
[staStations]="stationID"
[staStationTypes]="stationTypeID"
[translationTables]="sourceTable\",\"translatedKey"
[trnTranslationColumns]="tcID\",\"tcGroupID"
[trnTranslations]="tcID\",\"keyID\",\"languageID"
[warCombatZones]="combatZoneID"
[warCombatZoneSystems]="solarSystemID"
)
foreach tables schemadiff
pushd /tmp/diffs
echo "Files differing:"
shasum -a 256 *.sdeyaml.csv | sed -e 's/sdeyaml/sdetest/' | shasum -a 256 -c | grep FAILED | cut -f1 -d: | sed -e 's/.sdetest.csv//'
popd