1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Forgiving add index in migration (#16092)

This commit is contained in:
Paulus Schoutsen
2018-08-21 11:41:52 +02:00
committed by GitHub
parent ef07460792
commit 68cd65567d
2 changed files with 20 additions and 1 deletions

View File

@@ -80,3 +80,13 @@ def test_forgiving_add_column():
migration._add_columns(engine, 'hello', [
'context_id CHARACTER(36)',
])
def test_forgiving_add_index():
"""Test that add index will continue if index exists."""
engine = create_engine(
'sqlite://',
poolclass=StaticPool
)
models.Base.metadata.create_all(engine)
migration._create_index(engine, "states", "ix_states_context_id")