summaryrefslogtreecommitdiff
path: root/tests/test_sqlite.py
blob: 9ceb78e55803c8f3ea467a3d9f807923e10b2ccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from tests import op_fixture, assert_raises_message
from alembic import op
from sqlalchemy import Integer, Column,  Boolean
from sqlalchemy.sql import column

def test_add_column():
    context = op_fixture('sqlite')
    op.add_column('t1', Column('c1', Integer))
    context.assert_(
        'ALTER TABLE t1 ADD COLUMN c1 INTEGER'
    )

def test_add_column_implicit_constraint():
    context = op_fixture('sqlite')
    op.add_column('t1', Column('c1', Boolean))
    context.assert_(
        'ALTER TABLE t1 ADD COLUMN c1 BOOLEAN'
    )

def test_add_explicit_constraint():
    context = op_fixture('sqlite')
    assert_raises_message(
        NotImplementedError,
        "No support for ALTER of constraints in SQLite dialect",
        op.create_check_constraint,
        "foo",
        "sometable",
        column('name') > 5
    )

def test_drop_explicit_constraint():
    context = op_fixture('sqlite')
    assert_raises_message(
        NotImplementedError,
        "No support for ALTER of constraints in SQLite dialect",
        op.drop_constraint,
        "foo",
        "sometable",
    )