Migrations


Automatic Backups of Model


DenoGres has built-in functionality to automatically generate a backup of a model that was created whenever either of the the following commands are run:


denogres --db-pull
denogres --db-sync

Note that backups are listed in the order they were created.


Backups: --db-pull


Whenever a database pull is initiated, denogres will create a new backup of the models/model.ts that was generated from initiating db-pull and place a backup file in a directory with the following naming convention:


modelBuild_CURRENT_DATE_CURRENT_TIME

This directory will be subsequently stored within a Migrations folder which can be found within the root project directory. The path to the folder will be as follows:


Migrations/modelBuild_CURRENT_DATE_CURRENT_TIME

Within the folder the user will find three files:

  • Build_model.ts - The actual backup of the model when --db-pull was ran

  • Build_model.txt - Text file which will be needed later when invoking the -–compare cli command.

  • Migration_log.txt - A log that lists changes that have occurred from the model in the directory that sits above it. This log is essentially a linked list of changes from previous models.


Backups: --db-sync


When the user invokes the -–db-sync command, denogres will create a backup of the model that was synced to the postGres DB. This directory will be stored in the Migrations directory with the following naming convention:


syncedModel_CURRENT_DATE_CURRENT_TIME

The path to the directory will look like:


Migrations/syncedModel_CURRENT_DATE_CURRENT_TIME

Within the folder the user will find three files:

  • Model_changes.txt - A log of changes that have occurred from the last time dbsync was ran.

  • Synced_build.ts - The actual Model file that was used to sync to the external database, based on the date and timestamp after --db-sync finishes running.

  • Synced_build.txt - Text file which will be needed later when invoking the -–compare cli command.


DenoGres Comment Logs


Any time the user executes either --db-pull or --db-sync, Denogres will prompt the user to include a comment. This comment allows users to summarize any important changes that occurred as a result of the sync/pull, as well as any additional notes to be associated with the Model. When the cli command --log is ran, denogres will generate a historical log of all previous Model files, how those files were generated (either through pull or sync), the date and time of each creation, as well as any comments associated with those files.