1

I am trying to perform db version control in postgres for just one schema, lets call it mySchema.

Ideally I could use the api.create_model command below from the migrate.versioning package. The problem is I want to do this just for the mySchema (not for the postgres default, public schema). How I can accomplish this?

Here's the line that I would like to change:

from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO
#how do I change the create model command so that it  
#only creates models for tables in 'mySchema'?
old_model = api.create_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) 

https://sqlalchemy-migrate.readthedocs.org/en/v0.7.2/api.html#migrate.versioning.api.create_model

I would then use these current/old models to generate the differences between the new models and save the differences between versions.

Note: I don't think I can create a model for the whole database because I get an error on some tables which contain JSON or tsvector column types.

mgoldwasser
  • 14,558
  • 15
  • 79
  • 103

0 Answers0