This document describe requirements and how db app install is done. The db app install job is created by the DbDiff createdbfileinstall by going trough dbfiledifflist for normal files, dbdodatalist for tables with data that needs replacing and dbdoformlist will be used to implement the for update replace module.

the and making all files need available for doing the copy and patching of the application.

Then the after all is uploaded and made ready it is run by the dbinstaller rundbappinstallation method.

dbappjobs

The job description in dbappjobs is a array of array of strings where the first is a command and the second can be a filename or a table name. If the second parameter is a filename, it should only be the filename without path or relative to the repo path defined in settings as 'repopath'

Commands

'deletedata' Will find the table by in rdrr and then use the file name do remove all files related to it it from the repo, then mark it as deleted in rdrr.
'filecopy' copy the file that is listed as second string into the app with the same name
'filecopyto' copy a file and give it a new name on the destination.
Parameters:
- fromfile | the file to copy from as a relative name, lookup is done in dbappfiles for the real path to copy from
- tofile     | the name to give the file we copy to, this should be a relative name and the file is then copied from the dbappfile location and given a this name
'fileupload' just upload the file to apptemp\Data\filename to be processed by another jo, this command is only relevant if called using remoteuploaddbappfiles
'installdata' This job has parameter table name Ex. ['installdata','Address']. Then it used dbappdatafile with table name as key to get information on sending rdrr and what files to expect to find. Files that are uploaded to them and can be located by dbappfiles mapping to path by filename in files as key and absolute path as value. 
'installform' The job parameter is the form name. There can be a third parameter that is the form filename, if not given it will be found in the dbappdatafiles under the form name in the record description found in formdata
'installorreplacedata' If data table exist, this will do a replace data, if it do not exist, a installdata will be done
'installorreplaceform' Will do a install form if it do not exist and a replace form if it do.

'replacedata'

Replace the tables data and patch rdrrxaaa.rdr with correct settings from the repository copied from. Use dbappfiles to locate files to copy and dbappdatafile with data about what to do and change.
'replaceform' Updates Application Objects with the one we copy in and replace the frm with the new.

dbappfiles

This is used by filecopy to find the file to copy from. It should contain a dict with the file name as given in file copy parameter to look up the full file path to the file as stored in copy job. Ex. {'ADDRAAAA.DBM' : 'c:\\temp\\Data\ADDRAAAA.DBM',...}

dbappdatafiles

This is used by the more advanced commands to hold data about the operation.

 It use the name of the operation as key. This can be table name or form name. If the table name and form name are the same (as it is in many cases), the data for both are in the same value, just with separate keys in the object.

'files' A list of file name.
'formdata' The record description for the form in Application Objects
'rdrridx' The index where the rdrr record was found when data was created.
'rdrrrecord' Content of the rdrr record as read as dict. Used by installdata, installorreplacedata and replacedata.

equaldbappfiles

A list of checked files that are found equal on local and remote.

Upload and compare files

dbappfiles,dbappdatafile,equaldbappfiles = self.remoteuploaddbappfiles(self.currrepo,dbappjobs)

This method goes trough the job list and find all relevant files for each job and compare and upload files needed. All data needed for the install step is returned.

'filecopy'
'fileupload'
The command 'filecopy' and 'fileupload' takes relative filename from the repopath and upload it to apptemp\Data\filename for further processing later.
Adds a key with the filename as key and the full path on the server as value to dbappfiles dict as a result of the processing. This should rather than doing direct upload as now, do a file diff and hash first to see if there are differences with server before uploading.
'replacedata' The command 'replacedata' reads repo to get the repo letter if you not have read it in to dbappjobs your self using self.getdevrepoletter(repo). Then it will locate the table in the RDRRxAAA.RDR file and from that find the rest of the table files on local computer using the method dbappexpandfilelist.
'replaceform' This is a command to replace form with definition. To replace form and form data, you should read the table used by the form and add a replacedata command for that table.

All files that are added to the file list are then send to the server for a check if they exist and a file size and hash trough /dbappdatafilescheck/dname

Return values

dbappfiles returns a dict where the relative filename is the key and the absolute filepath from remote is the data

filedata returns a dict where you have the table/form name as key and then 'files' that are files related to the key, 'localfiles' that is data regarding these files for the local portion. This be filled with the local filesize and the result of calchash method.

Run install and patch

The next step is copy files, patch tables with data and patch forms when that is implemented.

self.remoterundbappinstallation(dbappjobs,dbappfiles,dbappdatafile,equaldbappfiles)

uploadjobs