/*ApVer 1.4.1 (14) DBVer 3.0 Time 541977779*/
CREATE TABLE IF NOT EXISTS CURBRAMP_UPDATES ('iPad' INTEGER PRIMARY KEY,'LastDataUpdate' INT,'LastPictUpdate' INT)
CREATE TABLE IF NOT EXISTS VERSION (vid INTEGER PRIMARY KEY,VersionID CHAR(6)); INSERT OR REPLACE INTO VERSION VALUES(1,'3.0'); CREATE TABLE IF NOT EXISTS Intersections ( intID INTEGER PRIMARY KEY, lastUpdateTime INTEGER, status INTEGER, assignedToPrelim INTEGER, assignedToDetail INTEGER, intX INTEGER, intY INTEGER, rotation INTEGER, ramp1 INTEGER, ramp2 INTEGER, ramp3 INTEGER, ramp4 INTEGER, ramp5 INTEGER, ramp6 INTEGER, ramp7 INTEGER, ramp8 INTEGER, ramp81 INTEGER, ramp23 INTEGER, ramp45 INTEGER, ramp67 INTEGER, xWalkA INTEGER, xWalkB INTEGER, xWalkC INTEGER, xWalkD INTEGER, signal81 INTEGER, signal23 INTEGER, signal45 INTEGER, signal67 INTEGER, nStreets INTEGER, streetNames CHAR(512), streetAZMs CHAR(128), latitude REAL, longitude REAL, intersectionComment CHAR(256), doLater INTEGER, zoomLevel INTEGER); CREATE VIRTUAL TABLE IF NOT EXISTS Intersections_index USING rtree(id,minX, maxX, minY, maxY);
CREATE TABLE IF NOT EXISTS Ramps ( intID INT, rampNum INT, rampID CHAR(16), yearRebuilt INT, timeComplete INT, rampExists INT, isComplete INT, approximateHeading REAL, adjustedRot INT, rampInXWalk INT, xWalkisComplete INT, signalisComplete INT, texture INT, upperLandingObstruction INT, lowerLandingObstruction INT, rampObstruction INT, hasRampCracks INT, hasUpperLandingCracks INT, hasStreetLandingCracks INT, rampWidth INT, rampDepth INT, rampSlopeFront REAL, rampSlopeSide REAL, rampSlopeHeading REAL, upperLandingSlopeFront REAL, upperLandingSlopeSide REAL, upperLandingSlopeHeading REAL, streetLandingSlopeFront REAL, streetLandingSlopeSide REAL, streetLandingSlopeHeading REAL, flareLeftSlopeFront REAL, flareLeftSlopeSide REAL, flareLeftSlopeHeading REAL, flareRightSlopeFront REAL, flareRightSlopeSide REAL, flareRightSlopeHeading REAL, swkLeftSlopeFront REAL, swkLeftSlopeSide REAL, swkLeftSlopeHeading REAL, swkRightSlopeFront REAL, swkRightSlopeSide REAL, swkRightSlopeHeading REAL, PEDSignalType INT, PEDButtonType INT, PEDButtonHeight INT, PEDButtonDist INT, SteepTopOfCurb REAL, PedRampLip REAL, lev21x INT, lev21y INT, rampType INT, rampComment CHAR(256), pedButtonAudibleWalkIndicationType INT, pedButtonHasLocatorTone INT, pedButtonHasInfoSign INT, pedButtonHasBraille INT, pedButtonHasTactileArrow INT, pedButtonLocatorToneVolume INT, pedButtonAudibleWalkIndicationVolume INT, rampCrackWidth REAL, upperLandingCrackWidth REAL, streetLandingCrackWidth REAL, leftSidewalkCrackWidth REAL, rightSidewalkCrackWidth REAL, curbCutDist REAL, bumpWidth REAL, bumpHeight REAL, detectableWidth INT, detectableDepth INT, PRIMARY KEY (intID,rampNum ASC));
CREATE TABLE IF NOT EXISTS CURBRAMP_PICTURES ('id' INTEGER PRIMARY KEY,'iPadNum' INT,'pictNum' INT,'intID' INT,'rampNum' INT, 'type' INT, 'heading' INT, 'latitude' REAL, 'longitude' REAL, 'time' INT)
CREATE TABLE IF NOT EXISTS CURBRAMP_NOTES ('id' INTEGER PRIMARY KEY,'intID' INT,'corner' INT,'rampID' INT,'type' INT, 'note' CHAR(4096))
CREATE TABLE IF NOT EXISTS CURBRAMP_STANDARD_TEXT ('textID' INTEGER PRIMARY KEY,'type' INT,'text' CHAR(4096))