Esempio n. 1
0
    def setup_class(cls):
        staging_env()
        cls.bind = cls._get_bind()
        cls.m1 = cls._get_db_schema()
        cls.m1.create_all(cls.bind)
        cls.m2 = cls._get_model_schema()

        conn = cls.bind.connect()
        cls.context = context = MigrationContext.configure(
            connection=conn,
            opts={
                'compare_type': True,
                'compare_server_default':True,
                'target_metadata':cls.m2,
                'upgrade_token':"upgrades",
                'downgrade_token':"downgrades",
                'alembic_module_prefix':'op.',
                'sqlalchemy_module_prefix':'sa.',
            }
        )

        connection = context.bind
        cls.autogen_context = {
            'imports':set(),
            'connection':connection,
            'dialect':connection.dialect,
            'context':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 setup_class(cls):
        staging_env()
        cls.bind = cls._get_bind()
        cls.m1 = cls._get_db_schema()
        cls.m1.create_all(cls.bind)
        cls.m2 = cls._get_model_schema()

        conn = cls.bind.connect()
        cls.context = context = MigrationContext.configure(
            connection=conn,
            opts={
                'compare_type': True,
                'compare_server_default': True,
                'target_metadata': cls.m2,
                'upgrade_token': "upgrades",
                'downgrade_token': "downgrades",
                'alembic_module_prefix': 'op.',
                'sqlalchemy_module_prefix': 'sa.',
            })

        connection = context.bind
        cls.autogen_context = {
            'imports': set(),
            'connection': connection,
            'dialect': connection.dialect,
            'context': context
        }
Esempio n. 4
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
        }
 def setup_class(cls):
     cls.bind = db_for_dialect("postgresql")
     staging_env()
     context = MigrationContext.configure(
         connection = cls.bind.connect(),
         opts = {
             'compare_type':True,
             'compare_server_default':True
         }
     )
     connection = context.bind
     cls.autogen_context = {
         'imports':set(),
         'connection':connection,
         'dialect':connection.dialect,
         'context':context
         }
Esempio n. 6
0
def setup():
    global cfg, env
    env = staging_env()
    cfg = _no_sql_testing_config()
    cfg.set_main_option('dialect_name', 'sqlite')
    cfg.remove_main_option('url')
    global a, b, c
    a, b, c = three_rev_fixture(cfg)
Esempio n. 7
0
 def setup_class(cls):
     cls.bind = db_for_dialect("postgresql")
     staging_env()
     context = MigrationContext.configure(
         connection = cls.bind.connect(),
         opts = {
             'compare_type':True,
             'compare_server_default':True
         }
     )
     connection = context.bind
     cls.autogen_context = {
         'imports':set(),
         'connection':connection,
         'dialect':connection.dialect,
         'context':context
         }
Esempio n. 8
0
    def setUp(self):
        env = staging_env()
        self.cfg = cfg = _no_sql_testing_config()

        self.rid = rid = util.rev_id()

        self.script = script = ScriptDirectory.from_config(cfg)
        script.generate_revision(rid, None, refresh=True)
    def setUp(self):
        env = staging_env()
        self.cfg = cfg = _no_sql_testing_config()

        self.rid = rid = util.rev_id()

        self.script = script = ScriptDirectory.from_config(cfg)
        script.generate_revision(rid, None, refresh=True)
def setup():
    global env
    env = staging_env()
    global a, b, c, d, e
    a = env.generate_revision(util.rev_id(), '->a', refresh=True)
    b = env.generate_revision(util.rev_id(), 'a->b', refresh=True)
    c = env.generate_revision(util.rev_id(), 'b->c', refresh=True)
    d = env.generate_revision(util.rev_id(), 'c->d', refresh=True)
    e = env.generate_revision(util.rev_id(), 'd->e', refresh=True)
def setup():
    global env
    env = staging_env()
    global a, b, c, d, e
    a = env.generate_revision(util.rev_id(), '->a', refresh=True)
    b = env.generate_revision(util.rev_id(), 'a->b', refresh=True)
    c = env.generate_revision(util.rev_id(), 'b->c', refresh=True)
    d = env.generate_revision(util.rev_id(), 'c->d', refresh=True)
    e = env.generate_revision(util.rev_id(), 'd->e', refresh=True)
Esempio n. 12
0
def setup():
    global env
    env = staging_env()
    global a, b, c, d, e
    a = env.generate_revision(util.rev_id(), None, refresh=True)
    b = env.generate_revision(util.rev_id(), None, refresh=True)
    c = env.generate_revision(util.rev_id(), None, refresh=True)
    d = env.generate_revision(util.rev_id(), None, refresh=True)
    e = env.generate_revision(util.rev_id(), None, refresh=True)
Esempio n. 13
0
def setup():
    global env
    env = staging_env()
    global a, b, c, d, e
    a = env.generate_revision(util.rev_id(), None, refresh=True)
    b = env.generate_revision(util.rev_id(), None, refresh=True)
    c = env.generate_revision(util.rev_id(), None, refresh=True)
    d = env.generate_revision(util.rev_id(), None, refresh=True)
    e = env.generate_revision(util.rev_id(), None, refresh=True)
Esempio n. 14
0
    def setUp(self):
        env = staging_env(template='cqlengine')
        self.cfg = cfg = _cqlengine_testing_config()

        #self.rid = rid = util.rev_id()

        #self.script = script = ScriptDirectory.from_config(cfg)
        #script.generate_revision(rid, None, refresh=True)
        #script.generate_revision(None, None, refresh=True)
        self.write_scripts()
Esempio n. 15
0
    def test_006_from_clean_env(self):
        # test the environment so far with a
        # new ScriptDirectory instance.

        env = staging_env(create=False)
        abc_rev = env._revision_map[abc]
        def_rev = env._revision_map[def_]
        eq_(abc_rev.nextrev, set([def_]))
        eq_(abc_rev.revision, abc)
        eq_(def_rev.down_revision, abc)
        eq_(env.get_heads(), [def_])
Esempio n. 16
0
    def test_006_from_clean_env(self):
        # test the environment so far with a
        # new ScriptDirectory instance.

        env = staging_env(create=False)
        abc_rev = env._revision_map[abc]
        def_rev = env._revision_map[def_]
        eq_(abc_rev.nextrev, set([def_]))
        eq_(abc_rev.revision, abc)
        eq_(def_rev.down_revision, abc)
        eq_(env.get_heads(), [def_])
    def setUp(self):
        global cfg, env, a
        env = staging_env()
        cfg = _no_sql_testing_config()
        cfg.set_main_option('dialect_name', 'sqlite')
        cfg.remove_main_option('url')
        a = util.rev_id()
        script = ScriptDirectory.from_config(cfg)
        script.generate_revision(a, "revision a", refresh=True)
        write_script(script, a, """# coding: utf-8
from __future__ import unicode_literals
revision = '%s'
down_revision = None

from alembic import op

def upgrade():
    op.execute("« S’il vous plaît…")

def downgrade():
    op.execute("drôle de petite voix m’a réveillé")

""".encode('utf-8') % a)
    def setUp(self):
        env = staging_env()
        self.cfg = _no_sql_testing_config()

        global a, b, c
        a, b, c = three_rev_fixture(self.cfg)
Esempio n. 19
0
    def setup_class(cls):
        env = staging_env()
        cls.cfg = cfg = _no_sql_testing_config("mssql")

        cls.a, cls.b, cls.c = \
            three_rev_fixture(cfg)
Esempio n. 20
0
 def setup_class(cls):
     global env
     env = staging_env()
Esempio n. 21
0
 def test_007_no_refresh(self):
     rid = util.rev_id()
     script = env.generate_revision(rid, "dont' refresh")
     is_(script, None)
     env2 = staging_env(create=False)
     eq_(env2._as_rev_number("head"), rid)
Esempio n. 22
0
 def setUp(self):
     staging_env()
     self.cfg = _no_sql_testing_config(
         directives="\nrevision_environment=true\n"
     )
 def setup_class(cls):
     cls.env = staging_env()
     cls.cfg = _sqlite_testing_config()
Esempio n. 24
0
 def setUp(self):
     staging_env()
     self.cfg = _no_sql_testing_config(
         directives="\nrevision_environment=true\n")
Esempio n. 25
0
 def setUp(self):
     self.env = staging_env()
     self.cfg = _sqlite_testing_config()
    def setUp(self):
        env = staging_env()
        self.cfg = _no_sql_testing_config()

        global a, b, c
        a, b, c = three_rev_fixture(self.cfg)
Esempio n. 27
0
    def setup_class(cls):
        env = staging_env()
        cls.cfg = cfg = _no_sql_testing_config("oracle")

        cls.a, cls.b, cls.c = \
            three_rev_fixture(cfg)
Esempio n. 28
0
 def setup_class(cls):
     cls.env = staging_env()
     cls.cfg = _sqlite_testing_config()
Esempio n. 29
0
 def setup_class(cls):
     global env
     env = staging_env()
Esempio n. 30
0
 def test_007_no_refresh(self):
     rid = util.rev_id()
     script = env.generate_revision(rid, "dont' refresh")
     is_(script, None)
     env2 = staging_env(create=False)
     eq_(env2._as_rev_number("head"), rid)
 def setUp(self):
     self.env = staging_env()
     self.cfg = _sqlite_testing_config()