def setup_class(cls): staging_env() cls.bind = sqlite_db() cls.m3 = _model_three() cls.m3.create_all(cls.bind) cls.m4 = _model_four() cls.empty_context = empty_context = MigrationContext.configure( connection = cls.bind.connect(), opts = { 'compare_type':True, 'compare_server_default':True, 'target_metadata':cls.m3, 'upgrade_token':"upgrades", 'downgrade_token':"downgrades", 'alembic_module_prefix':'op.', 'sqlalchemy_module_prefix':'sa.' } ) connection = empty_context.bind cls.autogen_empty_context = { 'imports':set(), 'connection':connection, 'dialect':connection.dialect, 'context':empty_context }
def setup_class(cls): staging_env() cls.bind = sqlite_db() cls.m3 = _model_three() cls.m3.create_all(cls.bind) cls.m4 = _model_four() cls.empty_context = empty_context = MigrationContext.configure( connection=cls.bind.connect(), opts={ 'compare_type': True, 'compare_server_default': True, 'target_metadata': cls.m3, 'upgrade_token': "upgrades", 'downgrade_token': "downgrades", 'alembic_module_prefix': 'op.', 'sqlalchemy_module_prefix': 'sa.' }) connection = empty_context.bind cls.autogen_empty_context = { 'imports': set(), 'connection': connection, 'dialect': connection.dialect, 'context': empty_context }
def _get_bind(cls): return sqlite_db()
def test_004_downgrade(self): command.downgrade(self.cfg, "base") db = sqlite_db() assert not db.dialect.has_table(db.connect(), "foo") assert not db.dialect.has_table(db.connect(), "bar") assert not db.dialect.has_table(db.connect(), "bat")
def test_002_upgrade(self): command.upgrade(self.cfg, c) db = sqlite_db() assert db.dialect.has_table(db.connect(), "foo") assert db.dialect.has_table(db.connect(), "bar") assert db.dialect.has_table(db.connect(), "bat")
def test_005_upgrade(self): command.upgrade(self.cfg, b) db = sqlite_db() assert db.dialect.has_table(db.connect(), 'foo') assert db.dialect.has_table(db.connect(), 'bar') assert not db.dialect.has_table(db.connect(), 'bat')
def test_004_downgrade(self): command.downgrade(self.cfg, 'base') db = sqlite_db() assert not db.dialect.has_table(db.connect(), 'foo') assert not db.dialect.has_table(db.connect(), 'bar') assert not db.dialect.has_table(db.connect(), 'bat')