migration.md 1.1KB

Performing migrations

Introduction

This document is intended to developers.

Migrations on Tracim lays on alembic which is the migration tool dedicated to SQLAlchemy.

In order to use the alembic commands, change your current directory to be tracim/ from the root of the project, also usually named tracim/ and active the Tracim virtualenv:

user@host:~/tracim_backend$ cd tracim/
user@host:~/tracim_backend/tracim$ source env/bin/activate
(env) user@host:~/tracim_backend/tracim$

Migration howto - Overview

Upgrading schema to last revision

alembic -c development.ini upgrade head

Downgrading schema

alembic -c development.ini downgrade -1

Migration howto - Advanced (for developers)

Retrieving schema current version

alembic -c development.ini current

Creating new schema migration

This creates a new auto-generated python migration file in tracim/migration/versions/ ending by migration_label.py:

alembic -c development.ini revision --autogenerate -m "migration label"