diff --git a/zipline/assets/asset_db_schema.py b/zipline/assets/asset_db_schema.py index 19660e90..29f6b568 100644 --- a/zipline/assets/asset_db_schema.py +++ b/zipline/assets/asset_db_schema.py @@ -1,7 +1,14 @@ import sqlalchemy as sa +# Define a version number for the database generated by these writers +# Increment this version number any time a change is made to the schema of the +# assets database +ASSET_DB_VERSION = 0 + + def generate_asset_db_metadata(bind=None): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value metadata = sa.MetaData(bind=bind) _version_table_schema(metadata) _equities_table_schema(metadata) @@ -12,19 +19,15 @@ def generate_asset_db_metadata(bind=None): return metadata -# Define a version number for the database generated by these writers -# Increment this version number any time a breaking change is made to the -# schema and readers of the database -ASSET_DB_VERSION = 0 - - # A list of the names of all tables in the assets db +# NOTE: When modifying this schema, update the ASSET_DB_VERSION value asset_db_table_names = ['version_info', 'equities', 'futures_exchanges', 'futures_root_symbols', 'futures_contracts', 'asset_router'] def _equities_table_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'equities', metadata, @@ -48,6 +51,7 @@ def _equities_table_schema(metadata): def _futures_exchanges_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'futures_exchanges', metadata, @@ -63,6 +67,7 @@ def _futures_exchanges_schema(metadata): def _futures_root_symbols_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'futures_root_symbols', metadata, @@ -85,6 +90,7 @@ def _futures_root_symbols_schema(metadata): def _futures_contracts_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'futures_contracts', metadata, @@ -119,6 +125,7 @@ def _futures_contracts_schema(metadata): def _asset_router_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'asset_router', metadata, @@ -133,6 +140,7 @@ def _asset_router_schema(metadata): def _version_table_schema(metadata): + # NOTE: When modifying this schema, update the ASSET_DB_VERSION value return sa.Table( 'version_info', metadata,