Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Changes to materialized_view_works SQL schema breaks migration script #485

Open
courte opened this issue Apr 4, 2017 · 0 comments
Open

Comments

@courte
Copy link
Contributor

courte commented Apr 4, 2017

When I'm running the migrate_db script on codebases set before March, the app raises an error because licensepools.open_access_download_url doesn't exist, even though migration 20170303-1 hasn't been run yet.

ERROR: Migration has been halted.
/Users/courte/dev/simplified/metadata/core/migration/20160719-fix-incorrectly-encoded-work-descriptions.py must be migrated manually.
==================================================
Traceback (most recent call last):
  File "/Users/courte/dev/simplified/metadata/core/scripts.py", line 1494, in run_migrations
    self._run_migration(full_migration_path, timestamp)
  File "/Users/courte/dev/simplified/metadata/core/scripts.py", line 1518, in _run_migration
    imp.load_source(module_name, migration_path)
  File "/Users/courte/dev/simplified/metadata/core/migration/20160719-fix-incorrectly-encoded-work-descriptions.py", line 30, in <module>
    results = qu.all()
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2588, in all
    return list(self)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in __iter__
    return self._execute_and_instances(context)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/Users/courte/dev/simplified/metadata/env/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
ProgrammingError: (psycopg2.ProgrammingError) column licensepools_1.open_access_download_url does not exist
LINE 1: ...se_opds_entry AS anon_1_works_verbose_opds_entry, licensepoo...
                                                             ^
 [SQL: 'SELECT anon_1.works_id AS anon_1_works_id, anon_1.works_presentation_edition_id AS anon_1_works_presentation_edition_id, anon_1.works_audience AS anon_1_works_audience, anon_1.works_target_age AS anon_1_works_target_age, anon_1.works_fiction AS anon_1_works_fiction, anon_1.works_summary_id AS anon_1_works_summary_id, anon_1.works_summary_text AS anon_1_works_summary_text, anon_1.works_quality AS anon_1_works_quality, anon_1.works_rating AS anon_1_works_rating, anon_1.works_popularity AS anon_1_works_popularity, anon_1.works_random AS anon_1_works_random, anon_1.works_primary_appeal AS anon_1_works_primary_appeal, anon_1.works_secondary_appeal AS anon_1_works_secondary_appeal, anon_1.works_appeal_character AS anon_1_works_appeal_character, anon_1.works_appeal_language AS anon_1_works_appeal_language, anon_1.works_appeal_setting AS anon_1_works_appeal_setting, anon_1.works_appeal_story AS anon_1_works_appeal_story, anon_1.works_last_update_time AS anon_1_works_last_update_time, anon_1.works_presentation_ready AS anon_1_works_presentation_ready, anon_1.works_presentation_ready_attempt AS anon_1_works_presentation_ready_attempt, anon_1.works_presentation_ready_exception AS anon_1_works_presentation_ready_exception, anon_1.works_simple_opds_entry AS anon_1_works_simple_opds_entry, anon_1.works_verbose_opds_entry AS anon_1_works_verbose_opds_entry, licensepools_1.open_access_download_url AS licensepools_1_open_access_download_url, licensepools_1.id AS licensepools_1_id, licensepools_1.work_id AS licensepools_1_work_id, licensepools_1.data_source_id AS licensepools_1_data_source_id, licensepools_1.identifier_id AS licensepools_1_identifier_id, licensepools_1.presentation_edition_id AS licensepools_1_presentation_edition_id, licensepools_1.availability_time AS licensepools_1_availability_time, licensepools_1.superceded AS licensepools_1_superceded, licensepools_1.suppressed AS licensepools_1_suppressed, licensepools_1.license_exception AS licensepools_1_license_exception, licensepools_1.open_access AS licensepools_1_open_access, licensepools_1.last_checked AS licensepools_1_last_checked, licensepools_1.licenses_owned AS licensepools_1_licenses_owned, licensepools_1.licenses_available AS licensepools_1_licenses_available, licensepools_1.licenses_reserved AS licensepools_1_licenses_reserved, licensepools_1.patrons_in_hold_queue AS licensepools_1_patrons_in_hold_queue, datasources_1.id AS datasources_1_id, datasources_1.name AS datasources_1_name, datasources_1.offers_licenses AS datasources_1_offers_licenses, datasources_1.primary_identifier_type AS datasources_1_primary_identifier_type, datasources_1.extra AS datasources_1_extra \nFROM (SELECT works.id AS works_id, works.presentation_edition_id AS works_presentation_edition_id, works.audience AS works_audience, works.target_age AS works_target_age, works.fiction AS works_fiction, works.summary_id AS works_summary_id, works.summary_text AS works_summary_text, works.quality AS works_quality, works.rating AS works_rating, works.popularity AS works_popularity, works.random AS works_random, works.primary_appeal AS works_primary_appeal, works.secondary_appeal AS works_secondary_appeal, works.appeal_character AS works_appeal_character, works.appeal_language AS works_appeal_language, works.appeal_setting AS works_appeal_setting, works.appeal_story AS works_appeal_story, works.last_update_time AS works_last_update_time, works.presentation_ready AS works_presentation_ready, works.presentation_ready_attempt AS works_presentation_ready_attempt, works.presentation_ready_exception AS works_presentation_ready_exception, works.simple_opds_entry AS works_simple_opds_entry, works.verbose_opds_entry AS works_verbose_opds_entry \nFROM works \nWHERE works.summary_text IS NOT NULL ORDER BY works.id \n LIMIT %(param_1)s OFFSET %(param_2)s) AS anon_1 LEFT OUTER JOIN licensepools AS licensepools_1 ON anon_1.works_id = licensepools_1.work_id LEFT OUTER JOIN datasources AS datasources_1 ON datasources_1.id = licensepools_1.data_source_id ORDER BY anon_1.works_id'] [parameters: {'param_1': 1000, 'param_2': 0}]
None
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant