1.0.0 • Published 1 year ago

commandtron7 v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Sqlite Inspector

Project automates finding and fixing of sqlite database issues.

HOW TO USE

  • Install Dependencies: npm install
  • Build: npm run build
  • Run For Help: node commandtron-build sqlite --help

Deployment

To deploy this project run

Install Dependencies

  npm install

Build

  npm run build

Run For Help

  node commandtron-build sqlite --help

Commands

  1. compare - To compare user db schema with Vyapar Db
  2. integrity - to perform integrity check on User Db
  3. drop-index - to delete indexes on user db and to perform vacuum optimization
  4. fix-table - to fix the corrrupted tables on user db

Run for help for each command name

  node commandtron-build sqlite <command-name> --help 

Note - create a folder named database inside commandtron, copy user db inside that folder (rename with some easy name say user.vyp or test.vyp)

and copy latest Vyapar Db inside databse folder and rename it with master.vyp

eg - commandtron/database/user.vyp , commandtron/database/master.vyp.

Example compare

 node commandtron-build sqlite compare --db User.vyp -cm Vyapar
  • Response:

MESSAGE: => Missing Table

        {
        "tables": [
            "kb_firms",
            "kb_closed_link_txn_table",
            "audit_trails"
        ]
        }

MESSAGE: => Missing Columns

        {
        "columns": [
            {
            "table": "kb_names",
            "name": "name_expense_type"
            },
            {
            "table": "kb_linked_transactions",
            "name": "txn_destination_id",
            "type": "NUMERIC",
            "expectedType": "INTEGER"
            }
        ]
        }

Example integrity

  node commandtron-build sqlite integrity --db test.vyp

-Response: MESSAGE: => DB foreign key integrity test result

        {
          "foreignKeyCheckData": []
        }

MESSAGE: => DB integrity test result

        {
          "integrityCheckData": [
            {
              "integrity_check": "*** in database main ***\nPage 3930: never used"
            },
            {
              "integrity_check": "row 55524 missing from index LINEITEM_ITEM"
            },
            {
              "integrity_check": "row 55527 missing from index LINEITEM_ITEM"
            }, ]
        }

Example drop-index

  node commandtron-build sqlite drop-index --db test.vyp --indexes lineitem_txn_id_index TXN_NAME

-Response: MESSAGE: => Drop Index Query has been exceuted succeessfully

        {
          "info": "The List of dropped indexes",
          "indexArray": [
            "lineitem_txn_id_index",
            "TXN_NAME"
          ]
        }

MESSAGE: => vacuum command has been executed successfully

         {}

Example fix-table

  node commandtron-build sqlite fix-table --db  test.vyp -t  kb_settings

-Response: MESSAGE: => table fixed successfully

        {
          "tableName": "kb_settings"
        }

Release Deployment

Run For Help

  node commandtron-build release --help

Commands

  1. upload options To upload the necessary files on S3 bucket
  2. cache-clean options To clean the Cache
  3. revert options To revert the S3 files to the previous version
  4. list-versions options To list the versions of the file on S3

Run for help for each command name

  node commandtron-build release <command-name> --help 

Command options For Upload command

Options: -bt, --build-type <buildType...> set build type as qa or prod (choices: "qa", "prod") -p, --platform <platform...> set platform as windows or mac or both (choices: "win", "mac") -rt, --release-type <releaseType...> set release type as new or update or nsis (choices: "new", "update", "nsis") -v --version version of the app -h, --help display help for command

Example For Uploads

To upload windows file for new downloads

  node commandtron-build release upload -bt prod -rt new -p win -v 10.15.4 

To upload mac files for new downloads

  node commandtron-build release upload -bt prod -rt new -p mac -v 10.15.4 

To upload windows file for update

  node commandtron-build release upload -bt prod -rt update -p win -v 10.15.4 

To upload mac file for update

  node commandtron-build release upload -bt prod -rt update -p mac -v 10.15.4 

To upload nsis files

  node commandtron-build release upload -bt prod -rt nsis -p win -v 10.15.4 

Command options for cache-clean command

Options: -bt, --build-type <buildType...> set build type as qa or prod (choices: "qa", "prod", default: default build type for cache-clean is prod) -p, --platform <platform...> set platform as windows or mac or both (choices: "win", "mac") -rt, --release-type <releaseType...> set release type as new or update or nsis (choices: "new", "update", "nsis") -v --version version of the app -h, --help display help for command

Example For cache-clean

To clean-cache of windows file for new downloads

  node commandtron-build release cache-clean -bt prod -rt new -p win -v 10.15.4 

To clean-cache of mac files for new downloads

  node commandtron-build release cache-clean -bt prod -rt new -p mac -v 10.15.4 

To clean-cache of windows file for update

  node commandtron-build release cache-clean -bt prod -rt update -p win -v 10.15.4 

To clean-cache of mac file for update

  node commandtron-build release cache-clean -bt prod -rt update -p mac -v 10.15.4 

To clean-cache of nsis files

  node commandtron-build release cache-clean -bt prod -rt nsis -p win -v 10.15.4 

Command options for revert command

Options: -bt, --build-type <buildType...> set build type as qa or prod (choices: "qa", "prod", default: default build type for revert is prod) -p, --platform <platform...> set platform as windows or mac or both (choices: "win", "mac") -rt, --release-type <releaseType...> set release type as new or update or nsis (choices: "new", "update", "nsis") -vi, --version-index move to the specified version index (default: by default files will be reverted to previous version index) -v --version version of the app

Example for revert command ( please clean-cache after successful execution of revert command )

Note - here version given by -v flag is not the version to which the files would be reverted, files would be reverted to previous version or to the specified version only , instead this version given by -v flag would be used as a meta-data for the reverted file.

To revert windows file for new downloads to previous version on S3

  node commandtron-build release revert -bt prod -rt new -p win -v 10.15.4 

To revert mac files for new downloads to previous version on S3

  node commandtron-build release revert -bt prod -rt new -p mac -v 10.15.4 

To revert windows file for new downloads to a specified version .

  node commandtron-build release revert -bt prod -rt new -p win -v 10.15.2 -vi 2 
  ## this will revert files to 2 versions before the latest version , i.e one version older than the previous version

To revert mac file for new downloads to a specified version .

  node commandtron-build release revert -bt prod -rt new -p mac -v 10.15.4 -vi 2 
  ## this will revert files to 2 versions before the latest version , i.e one version older than the previous version

Sample Response received by the revert command and few key pointers -

MESSAGE: => revert for file was successfull, please clean the cache explicitly after the revert

{
  "filePath": "desktop.vyaparapp.in/v2/VyaparApp.exe", 
  "tagData": [
    {
      "Key": "version",
      "Value": "10.16.0"  // NOTE - This tag info shows the vyapar app version of the file to which the revert was pointed. 
    }
  ],
  "copyObjectRespone": {
    "$metadata": {
      "httpStatusCode": 200,
      "requestId": "00A2SNDAJ9XG9EAZ",
      "extendedRequestId": "BzQB+sSqvjydLCObk1oRnfKXmUZusFWrg6eGh9VbtNtwqkwUvASNuq1+UQzXDBmgzdkH+j2nxrE=",
      "attempts": 1,
      "totalRetryDelay": 0
    },
    "CopySourceVersionId": "65M96wYWTjbApurkrq2OJ6gYSvzKYsBN", // NOTE - This is the version id of the file, which we wanted to set as the latest ( or say revert ).
    "VersionId": "LIygUgXb1j_jjUgwPS5Iyx.hxtSRP8v0",           
    "ServerSideEncryption": "AES256",
    "CopyObjectResult": {
      "ETag": "\"f95aa2bbf94abc5e5703367b981ed803\"",
      "LastModified": "2024-06-11T13:44:50.000Z"
    }
  }
}

Command options for list-versions command

Options: -bt, --build-type <buildType...> set build type as qa or prod (choices: "qa", "prod", default: default build type for revert is prod) -p, --platform <platform...> set platform as windows or mac or both (choices: "win", "mac") -rt, --release-type <releaseType...> set release type as new or update or nsis (choices: "new", "update", "nsis") -v --version version of the app, only needed in case of update files as their names contain versions. -h, --help display help for commandlp for command

Example for list-versions command

To list version of all windows file for new downloads

  node commandtron-build release list-versions -bt prod -rt new -p win 

To list version of all mac file for new downloads

  node commandtron-build release list-versions -bt prod -rt mac -p win  

Note - Examples for all combinations of options of platform (win, mac) , build-type (prod , qa ) , release-type ( new , update , nsis) has not been given for all the commands.

However the developer may use different choices of options to perform the desired avaialble action respective to upload , cache-clean , revert and list-versions.

Upload Source Maps to senty

Note: Make sure the source-map files are already created and stored in Vyapar_desktop/src folder.

To upload source maps on sentry 1- create a .sentryclirc file in Vyapar_desktop/commandtron folder and copy and paste the content of .sentryclirc.template file in it. 2- Add your sentry auth-token in the .sentryclirc file. 3- Run the upload-sourcemaps.sh script at path Vyapar_desktop/commandtron 4- Provide release-version and project name as arguments.

Example for upload-sourcemaps

./upload-sourcemaps.sh 10.16.5 electron22-staging