astakos: Fix sqlite-related issues in migration
In migration 0022, ProjectApplication's field `chain' is altered from a plain integer field to a foreign key. This triggers a south command to create an index for the said field. However, it seems that sqlite creates this index automatically, before the create_index command is issued, which subsequently fails. A check is added here, to handle this case by skipping the create_index command. Also, reinstate the data migration part, removed by commit 64c5e1e, but only if db.dry_run is false. In sqlite, before actually applying it, a migration is first dry run, in which case data-altering code should not be run.