# # Upgrades & Migrations

> A Project is a complete instance of Gitaflow, including its Database, config file, asset storage, and any custom extensions. Learn more about Projects.

## # Upgrading / Updating a Project

1. Backup your project
2. Run `npm update`
3. Run `npx gitaflow database migrate:latest` to update the DB

## # Backing-up a Project

1. Make a copy of the files within each storage adapter, and store them in a safe place
2. Make a copy of the Env file (`/api/.env`), and store it in a safe place
3. Create a database dump

## # Migrating a Project

Gitaflow doesn't rely on anything besides the database for it's operation. Therefore, migrating your Gitaflow project can be done by moving the whole database to a new location using a database dump.

File Storage

If you have files uploaded, make sure to copy those over as well, or use the same storage location in the new location of Gitaflow.

## # Downgrading a Project

Gitaflow can be reverted to an earlier version by going to your terminal, navigating into your project folder and running `npm install gitaflow@<version>`.

If you ran any database migrations for a newer version, you can revert those by running `npx gitaflow database migrate:down`

## # Deleting a Project

1. Optional: Backup any local files stored within the project's root directory
2. Optional: Backup any custom code and extensions within the project's root directory
3. Optional: Backup your entire database, only system tables, or only project tables
4. Delete the project's root directory from the server
5. Delete all Gitaflow system tables (`gitaflow_*`) from the database

Pure SQL

After completing this process, you will be left with a pure SQL database, with no trace that Gitaflow was ever installed. Any external services connecting to your database's project tables directly (eg: SQL queries) should continue working normally.

## # Migrating from v8

There are two ways to migrate from an existing Gitaflow 8.X instance:

- Automated Script (recommended)
- Manual Database Export/Import

Be sure to check the Breaking changes if you are consuming the API from an application.

## # Automated Script

We created a (community maintained) script, that will automatically copy over the schema, content, files, users, and roles from an existing v8 instance to a new v9 instance. This is the most hands-off approach to moving from a v8 to a v9 instance, and is the recommended way of migrating your v8 instance.

TIP

The script, and instructions on how to run it, can be found on the
`gitaflow-community/migration-tool`
(opens new window) repo.

This tool will copy over:

- Schema (collections / fields)
- Files (including file contents)
- User data (eg all items in all collections)
- Roles
- Users

Due to significant differences in data structure between versions, this tool will NOT copy over:

- Interface/display configurations
- Permissions
- Activity / revisions

## # Manual Database Export/Import

Automated

We highly recommend using the automated migration tool mentioned above. If that's not possible, you can perform the following steps to migrate your v8 instance.

Gitaflow v9 is a breaking change coming from v8 (hence the major version bump), so you won't be able to just use your existing v8 database and run v9 on top of it. However, due to the database-mirroring approach of Gitaflow, it's fairly straightforward to migrate your content from v8 to v9.

#### # 1) Setup a Fresh v9 Instance

By installing Gitaflow "fresh", you're ensured your system tables are up-to-date and ready to go.

#### # 2) Migrate your Data

Using a tool like Sequel Pro
(opens new window) or TablePlus
(opens new window), export your v8 user-tables and import them into your v9 database.

Gitaflow v9 will automatically recognize your tables, and you'll be ready to get started in v9.

Note: If you have references to users and files, make sure to update them to the new UUID format.

#### # 3) Configure Gitaflow

Once the tables are in, you can start configuring the details of the schema. This includes choosing the correct interfaces, displays, and their options for your fields.

This would also be a good time to reconfigure your permissions, to ensure they are accurate.

## # Breaking changes

- Filter operators have changed, now they are preceded with an underscore eg: `/items/users?filter[comments.thread.title][like]=Gitaflow` is now `/items/users?filter[comments][thread][title][_like]=Gitaflow`