text: begin_unit
  comment|'# Copyright 2014 Rackspace Hosting'
  nl|'\n'
  comment|'#'
  nl|'\n'
  comment|'#    Licensed under the Apache License, Version 2.0 (the "License"); you may'
  nl|'\n'
  comment|'#    not use this file except in compliance with the License. You may obtain'
  nl|'\n'
  comment|'#    a copy of the License at'
  nl|'\n'
  comment|'#'
  nl|'\n'
  comment|'#         http://www.apache.org/licenses/LICENSE-2.0'
  nl|'\n'
  comment|'#'
  nl|'\n'
  comment|'#    Unless required by applicable law or agreed to in writing, software'
  nl|'\n'
  comment|'#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
  nl|'\n'
  comment|'#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
  nl|'\n'
  comment|'#    License for the specific language governing permissions and limitations'
  nl|'\n'
  comment|'#    under the License.'
  nl|'\n'
  nl|'\n'
  name|'from'
  name|'migrate'
  name|'import'
  name|'ForeignKeyConstraint'
  op|','
  name|'UniqueConstraint'
  newline|'\n'
  name|'from'
  name|'oslo_db'
  op|'.'
  name|'sqlalchemy'
  name|'import'
  name|'utils'
  newline|'\n'
  name|'from'
  name|'sqlalchemy'
  name|'import'
  name|'MetaData'
  op|','
  name|'schema'
  op|','
  name|'Table'
  newline|'\n'
  nl|'\n'
  nl|'\n'
  DECL|variable|FKEYS
  name|'FKEYS'
  op|'='
  op|'['
  nl|'\n'
  op|'('
  string|"'fixed_ips'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'fixed_ips_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'block_device_mapping'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'block_device_mapping_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_info_caches'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'instance_info_caches_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_metadata'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'instance_metadata_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_system_metadata'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'instance_system_metadata_ibfk_1'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_type_projects'"
  op|','
  string|"'instance_type_id'"
  op|','
  string|"'instance_types'"
  op|','
  string|"'id'"
  op|','
  nl|'\n'
  string|"'instance_type_projects_ibfk_1'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'iscsi_targets'"
  op|','
  string|"'volume_id'"
  op|','
  string|"'volumes'"
  op|','
  string|"'id'"
  op|','
  nl|'\n'
  string|"'iscsi_targets_volume_id_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'reservations'"
  op|','
  string|"'usage_id'"
  op|','
  string|"'quota_usages'"
  op|','
  string|"'id'"
  op|','
  nl|'\n'
  string|"'reservations_ibfk_1'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'security_group_instance_association'"
  op|','
  string|"'instance_uuid'"
  op|','
  nl|'\n'
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'security_group_instance_association_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'security_group_instance_association'"
  op|','
  string|"'security_group_id'"
  op|','
  nl|'\n'
  string|"'security_groups'"
  op|','
  string|"'id'"
  op|','
  nl|'\n'
  string|"'security_group_instance_association_ibfk_1'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'virtual_interfaces'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'virtual_interfaces_instance_uuid_fkey'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'compute_nodes'"
  op|','
  string|"'service_id'"
  op|','
  string|"'services'"
  op|','
  string|"'id'"
  op|','
  nl|'\n'
  string|"'fk_compute_nodes_service_id'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_actions'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'fk_instance_actions_instance_uuid'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_faults'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'fk_instance_faults_instance_uuid'"
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'migrations'"
  op|','
  string|"'instance_uuid'"
  op|','
  string|"'instances'"
  op|','
  string|"'uuid'"
  op|','
  nl|'\n'
  string|"'fk_migrations_instance_uuid'"
  op|')'
  op|','
  nl|'\n'
  op|']'
  newline|'\n'
  nl|'\n'
  DECL|variable|UNIQUES
  name|'UNIQUES'
  op|'='
  op|'['
  nl|'\n'
  op|'('
  string|"'compute_nodes'"
  op|','
  string|"'uniq_compute_nodes0host0hypervisor_hostname'"
  op|','
  nl|'\n'
  op|'['
  string|"'host'"
  op|','
  string|"'hypervisor_hostname'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'fixed_ips'"
  op|','
  string|"'uniq_fixed_ips0address0deleted'"
  op|','
  nl|'\n'
  op|'['
  string|"'address'"
  op|','
  string|"'deleted'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_info_caches'"
  op|','
  string|"'uniq_instance_info_caches0instance_uuid'"
  op|','
  nl|'\n'
  op|'['
  string|"'instance_uuid'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'instance_type_projects'"
  op|','
  nl|'\n'
  string|"'uniq_instance_type_projects0instance_type_id0project_id0deleted'"
  op|','
  nl|'\n'
  op|'['
  string|"'instance_type_id'"
  op|','
  string|"'project_id'"
  op|','
  string|"'deleted'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'pci_devices'"
  op|','
  string|"'uniq_pci_devices0compute_node_id0address0deleted'"
  op|','
  nl|'\n'
  op|'['
  string|"'compute_node_id'"
  op|','
  string|"'address'"
  op|','
  string|"'deleted'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|'('
  string|"'virtual_interfaces'"
  op|','
  string|"'uniq_virtual_interfaces0address0deleted'"
  op|','
  nl|'\n'
  op|'['
  string|"'address'"
  op|','
  string|"'deleted'"
  op|']'
  op|')'
  op|','
  nl|'\n'
  op|']'
  newline|'\n'
  nl|'\n'
  nl|'\n'
  DECL|function|upgrade
  name|'def'
  name|'upgrade'
  op|'('
  name|'migrate_engine'
  op|')'
  op|':'
  newline|'\n'
  indent|'    '
  name|'meta'
  op|'='
  name|'MetaData'
  op|'('
  op|')'
  newline|'\n'
  name|'meta'
  op|'.'
  name|'bind'
  op|'='
  name|'migrate_engine'
  newline|'\n'
  nl|'\n'
  name|'if'
  name|'migrate_engine'
  op|'.'
  name|'name'
  op|'=='
  string|"'sqlite'"
  op|':'
  newline|'\n'
  comment|'# SQLite is also missing this one index'
  nl|'\n'
  indent|'        '
  name|'if'
  name|'not'
  name|'utils'
  op|'.'
  name|'index_exists'
  op|'('
  name|'migrate_engine'
  op|','
  string|"'fixed_ips'"
  op|','
  string|"'address'"
  op|')'
  op|':'
  newline|'\n'
  indent|'            '
  name|'utils'
  op|'.'
  name|'add_index'
  op|'('
  name|'migrate_engine'
  op|','
  string|"'fixed_ips'"
  op|','
  string|"'address'"
  op|','
  nl|'\n'
  op|'['
  string|"'address'"
  op|']'
  op|')'
  newline|'\n'
  nl|'\n'
  dedent|''
  name|'for'
  name|'src_table'
  op|','
  name|'src_column'
  op|','
  name|'dst_table'
  op|','
  name|'dst_column'
  op|','
  name|'name'
  name|'in'
  name|'FKEYS'
  op|':'
  newline|'\n'
  indent|'            '
  name|'src_table'
  op|'='
  name|'Table'
  op|'('
  name|'src_table'
  op|','
  name|'meta'
  op|','
  name|'autoload'
  op|'='
  name|'True'
  op|')'
  newline|'\n'
  name|'if'
  name|'name'
  name|'in'
  name|'set'
  op|'('
  name|'fk'
  op|'.'
  name|'name'
  name|'for'
  name|'fk'
  name|'in'
  name|'src_table'
  op|'.'
  name|'foreign_keys'
  op|')'
  op|':'
  newline|'\n'
  indent|'                '
  name|'continue'
  newline|'\n'
  nl|'\n'
  dedent|''
  name|'src_column'
  op|'='
  name|'src_table'
  op|'.'
  name|'c'
  op|'['
  name|'src_column'
  op|']'
  newline|'\n'
  nl|'\n'
  name|'dst_table'
  op|'='
  name|'Table'
  op|'('
  name|'dst_table'
  op|','
  name|'meta'
  op|','
  name|'autoload'
  op|'='
  name|'True'
  op|')'
  newline|'\n'
  name|'dst_column'
  op|'='
  name|'dst_table'
  op|'.'
  name|'c'
  op|'['
  name|'dst_column'
  op|']'
  newline|'\n'
  nl|'\n'
  name|'fkey'
  op|'='
  name|'ForeignKeyConstraint'
  op|'('
  name|'columns'
  op|'='
  op|'['
  name|'src_column'
  op|']'
  op|','
  nl|'\n'
  name|'refcolumns'
  op|'='
  op|'['
  name|'dst_column'
  op|']'
  op|','
  nl|'\n'
  name|'name'
  op|'='
  name|'name'
  op|')'
  newline|'\n'
  name|'fkey'
  op|'.'
  name|'create'
  op|'('
  op|')'
  newline|'\n'
  nl|'\n'
  comment|"# SQLAlchemy versions < 1.0.0 don't reflect unique constraints"
  nl|'\n'
  comment|'# for SQLite correctly causing sqlalchemy-migrate to recreate'
  nl|'\n'
  comment|'# some tables with missing unique constraints. Re-add some'
  nl|'\n'
  comment|'# potentially missing unique constraints as a workaround.'
  nl|'\n'
  dedent|''
  name|'for'
  name|'table_name'
  op|','
  name|'name'
  op|','
  name|'column_names'
  name|'in'
  name|'UNIQUES'
  op|':'
  newline|'\n'
  indent|'            '
  name|'table'
  op|'='
  name|'Table'
  op|'('
  name|'table_name'
  op|','
  name|'meta'
  op|','
  name|'autoload'
  op|'='
  name|'True'
  op|')'
  newline|'\n'
  name|'if'
  name|'name'
  name|'in'
  name|'set'
  op|'('
  name|'c'
  op|'.'
  name|'name'
  name|'for'
  name|'c'
  name|'in'
  name|'table'
  op|'.'
  name|'constraints'
  nl|'\n'
  name|'if'
  name|'isinstance'
  op|'('
  name|'table'
  op|','
  name|'schema'
  op|'.'
  name|'UniqueConstraint'
  op|')'
  op|')'
  op|':'
  newline|'\n'
  indent|'                '
  name|'continue'
  newline|'\n'
  nl|'\n'
  dedent|''
  name|'uc'
  op|'='
  name|'UniqueConstraint'
  op|'('
  op|'*'
  name|'column_names'
  op|','
  name|'table'
  op|'='
  name|'table'
  op|','
  name|'name'
  op|'='
  name|'name'
  op|')'
  newline|'\n'
  name|'uc'
  op|'.'
  name|'create'
  op|'('
  op|')'
  newline|'\n'
  dedent|''
  dedent|''
  dedent|''
  endmarker|''
  end_unit
  