Database management
Reset, import or export the environment's stateSiteBox CLI empowers developers to replicate an online environment on their local machine using what are known as "snapshots." A "snapshot" is essentially a saved state of an environment that can be created and restored at any time. A snapshot can encompass various resources, including the codebase, media files, and databases. Users have the flexibility to create and restore snapshots in different configurations, such as only including media and the database.
How to restore the Environment?
Sometimes things don't go as planned, or you simply want to start from scratch with a clean state in your environment.
In such cases, ensure you are in the directory of your running environment and use the following command:
statik backend reset
It's important to note that this action will result in the loss of all data stored in the database. Therefore, exercise caution when using this command.
How to import a Snapshots?
The ability to leverage snapshots and apply them to a running local environment is a powerful feature of SiteBox CLI. Users can select which specific snapshot resources to apply, including the codebase, media, and database. However, it's crucial to be aware that there is a risk of data loss when importing a snapshot.
To initiate the import process, navigate to the directory of your running environment and run:
statik backend import
Then follow the prompts to select the desired resources and configuration.
How to export a Snapshots?
Creating a snapshot from your local machine's environment and sending it to a server allows you to recreate it in a production environment or share it with fellow developers who can replicate it on their local machines.
To export a snapshot, go to the environment's directory, execute the following command and follow the instructions:
statik backend export
This feature facilitates collaboration and simplifies the process of maintaining consistent environments across various stages of development.