Esempio n. 1
0
    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
            }
Esempio n. 2
0
    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
        }
Esempio n. 3
0
 def _get_bind(cls):
     return sqlite_db()
Esempio n. 4
0
 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")
Esempio n. 7
0
 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')
Esempio n. 8
0
 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')
Esempio n. 9
0
 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')
Esempio n. 10
0
 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')