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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
from alembic.testing.requirements import SuiteRequirements
from alembic.testing import exclusions
from alembic import util
from alembic.util import sqla_compat
class DefaultRequirements(SuiteRequirements):
@property
def schemas(self):
"""Target database must support external schemas, and have one
named 'test_schema'."""
return exclusions.skip_if([
"sqlite",
"firebird"
], "no schema support")
@property
def no_referential_integrity(self):
"""test will fail if referential integrity is enforced"""
return exclusions.fails_on_everything_except("sqlite")
@property
def non_native_boolean(self):
"""test will fail if native boolean is provided"""
return exclusions.fails_if(
exclusions.LambdaPredicate(
lambda config: config.db.dialect.supports_native_boolean
)
)
@property
def no_fk_names(self):
"""foreign key constraints *never* have names in the DB"""
return exclusions.only_if(
lambda config: exclusions.against(config, "sqlite")
and not util.sqla_100
)
@property
def check_constraints_w_enforcement(self):
return exclusions.fails_on("mysql")
@property
def unnamed_constraints(self):
"""constraints without names are supported."""
return exclusions.only_on(['sqlite'])
@property
def fk_names(self):
"""foreign key constraints always have names in the DB"""
return exclusions.fails_on('sqlite')
@property
def no_name_normalize(self):
return exclusions.skip_if(
lambda config: config.db.dialect.requires_name_normalize
)
@property
def reflects_fk_options(self):
return exclusions.only_on([
'postgresql', 'mysql',
lambda config: util.sqla_110 and
exclusions.against(config, 'sqlite')])
@property
def fk_initially(self):
"""backend supports INITIALLY option in foreign keys"""
return exclusions.only_on(['postgresql'])
@property
def fk_deferrable(self):
"""backend supports DEFERRABLE option in foreign keys"""
return exclusions.only_on(['postgresql'])
@property
def flexible_fk_cascades(self):
"""target database must support ON UPDATE/DELETE..CASCADE with the
full range of keywords (e.g. NO ACTION, etc.)"""
return exclusions.skip_if(
['oracle'],
'target backend has poor FK cascade syntax'
)
@property
def reflects_unique_constraints_unambiguously(self):
return exclusions.fails_on("mysql", "oracle")
@property
def reflects_pk_names(self):
"""Target driver reflects the name of primary key constraints."""
return exclusions.fails_on_everything_except(
'postgresql', 'oracle', 'mssql', 'sybase',
lambda config: (
util.sqla_110 and exclusions.against(config, "sqlite")
)
)
@property
def postgresql_uuid_ossp(self):
def check_uuid_ossp(config):
if not exclusions.against(config, "postgresql"):
return False
try:
config.db.execute("SELECT uuid_generate_v4()")
return True
except:
return False
return exclusions.only_if(check_uuid_ossp)
@property
def autoincrement_on_composite_pk(self):
return exclusions.skip_if(["sqlite"], "not supported by database")
@property
def integer_subtype_comparisons(self):
"""if a compare of Integer and BigInteger is supported yet."""
return exclusions.skip_if(["oracle"], "not supported by alembic impl")
def _mariadb_102(self, config):
return exclusions.against(config, "mysql") and \
sqla_compat._is_mariadb(config.db.dialect) and \
sqla_compat._mariadb_normalized_version_info(
config.db.dialect) > (10, 2)
def _mysql_not_mariadb_102(self, config):
return exclusions.against(config, "mysql") and (
not sqla_compat._is_mariadb(config.db.dialect) or
sqla_compat._mariadb_normalized_version_info(
config.db.dialect) < (10, 2)
)
|