Introspect indexes from the database prior to evolutions.

Review Request #5060 — Created Dec. 5, 2013 and submitted

Information

Django Evolution
master

Reviewers

Introspect indexes from the database prior to evolutions.

The naming of indexes vary between databases and versions of Django,
and can also be different if indexes were manually modified. Because of
this, we can't just guess index names.

This is the first part toward a solution. A new create_database_sig
method, and accompanying database backend methods, introspect the
database prior to evolutions to find the list of tables and their
indexes. From this, a coming change will be able to look up the correct
index, given a table and list of fields.

All the evolution-related functions require a database signature now.
These signatures are not stored, but are used throughout an evolution
as a representation of the original and then modified state of important
parts of the database.

A unit test was added to check loading signature state.

Unit tests pass for sqlite3, MySQL, and Postgres.

Description From Last Updated

Should this have a semicolon?

daviddavid

This could be formatted more pleasantly: evolver_func = getattr( self.evolver(model, database_sig, database), 'change_%s' % field_attr)

daviddavid
david
  1. 
      
  2. django_evolution/db/mysql.py (Diff revision 1)
     
     

    Should this have a semicolon?

  3. django_evolution/mutations.py (Diff revision 1)
     
     
     
     

    This could be formatted more pleasantly:

    evolver_func = getattr(
        self.evolver(model, database_sig, database),
        'change_%s' % field_attr)
    
  4. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...