Merge pull request #16094 from home-assistant/rc

0.76.2
This commit is contained in:
Paulus Schoutsen 2018-08-21 12:20:06 +02:00 committed by GitHub
commit 5a15b2c036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 5 deletions

View File

@ -26,7 +26,7 @@ from homeassistant.helpers.translation import async_get_translations
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util.yaml import load_yaml from homeassistant.util.yaml import load_yaml
REQUIREMENTS = ['home-assistant-frontend==20180818.0'] REQUIREMENTS = ['home-assistant-frontend==20180820.0']
DOMAIN = 'frontend' DOMAIN = 'frontend'
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log', DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log',

View File

@ -57,6 +57,7 @@ def _create_index(engine, table_name, index_name):
within the table definition described in the models within the table definition described in the models
""" """
from sqlalchemy import Table from sqlalchemy import Table
from sqlalchemy.exc import OperationalError
from . import models from . import models
table = Table(table_name, models.Base.metadata) table = Table(table_name, models.Base.metadata)
@ -67,7 +68,15 @@ def _create_index(engine, table_name, index_name):
_LOGGER.info("Adding index `%s` to database. Note: this can take several " _LOGGER.info("Adding index `%s` to database. Note: this can take several "
"minutes on large databases and slow computers. Please " "minutes on large databases and slow computers. Please "
"be patient!", index_name) "be patient!", index_name)
index.create(engine) try:
index.create(engine)
except OperationalError as err:
if 'already exists' not in str(err).lower():
raise
_LOGGER.warning('Index %s already exists on %s, continueing',
index_name, table_name)
_LOGGER.debug("Finished creating %s", index_name) _LOGGER.debug("Finished creating %s", index_name)

View File

@ -2,7 +2,7 @@
"""Constants used by Home Assistant components.""" """Constants used by Home Assistant components."""
MAJOR_VERSION = 0 MAJOR_VERSION = 0
MINOR_VERSION = 76 MINOR_VERSION = 76
PATCH_VERSION = '1' PATCH_VERSION = '2'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 5, 3) REQUIRED_PYTHON_VER = (3, 5, 3)

View File

@ -432,7 +432,7 @@ hole==0.3.0
holidays==0.9.6 holidays==0.9.6
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20180818.0 home-assistant-frontend==20180820.0
# homeassistant.components.homekit_controller # homeassistant.components.homekit_controller
# homekit==0.10 # homekit==0.10

View File

@ -81,7 +81,7 @@ hbmqtt==0.9.2
holidays==0.9.6 holidays==0.9.6
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20180818.0 home-assistant-frontend==20180820.0
# homeassistant.components.homematicip_cloud # homeassistant.components.homematicip_cloud
homematicip==0.9.8 homematicip==0.9.8

View File

@ -80,3 +80,13 @@ def test_forgiving_add_column():
migration._add_columns(engine, 'hello', [ migration._add_columns(engine, 'hello', [
'context_id CHARACTER(36)', '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")