Ejemplo n.º 1
0
            database_sig = pickle.loads(str(latest_version.signature))
            diff = Diff(database_sig, current_proj_sig)
        except Evolution.DoesNotExist:
            raise CommandError("Can't evolve yet. Need to set an "
                               "evolution baseline.")

        try:
            for app in app_list:
                app_label = app.__name__.split('.')[-2]
                if hint:
                    evolutions = []
                    hinted_evolution = diff.evolution()
                    temp_mutations = hinted_evolution.get(app_label, [])
                else:
                    evolutions = get_unapplied_evolutions(app, database)
                    temp_mutations = get_mutations(app, evolutions, database)

                mutations = [
                    mutation for mutation in temp_mutations
                    if mutation.is_mutable(app_label, database_sig, database)
                ]

                if mutations:
                    app_sql = ['-- Evolve application %s' % app_label]
                    evolution_required = True

                    for mutation in mutations:
                        # Only compile SQL if we want to show it
                        if compile_sql or execute:
                            app_sql.extend(
                                mutation.mutate(app_label, database_sig,
Ejemplo n.º 2
0
            database_sig = pickle.loads(str(latest_version.signature))
            diff = Diff(database_sig, current_proj_sig)
        except Evolution.DoesNotExist:
            print self.style.ERROR("Can't evolve yet. Need to set an evolution baseline.")
            sys.exit(1)
        
        try:
            for app in app_list:
                app_label = app.__name__.split('.')[-2]
                if hint:
                    evolutions = []
                    hinted_evolution = diff.evolution()
                    mutations = hinted_evolution.get(app_label,[])
                else:
                    evolutions = get_unapplied_evolutions(app)
                    mutations = get_mutations(app, evolutions)

                if mutations:
                    app_sql = ['-- Evolve application %s' % app_label]
                    evolution_required = True
                    for mutation in mutations:
                        # Only compile SQL if we want to show it
                        if compile_sql or execute:
                            app_sql.extend(mutation.mutate(app_label, database_sig))
                            
                        # Now run the simulation, which will modify the signatures
                        try:
                            mutation.simulate(app_label, database_sig)
                        except CannotSimulate:
                            simulated = False
                    new_evolutions.extend(Evolution(app_label=app_label, label=label) 
Ejemplo n.º 3
0
            database_sig = pickle.loads(str(latest_version.signature))
            diff = Diff(database_sig, current_proj_sig)
        except Evolution.DoesNotExist:
            raise CommandError("Can't evolve yet. Need to set an "
                               "evolution baseline.")

        try:
            for app in app_list:
                app_label = app.__name__.split('.')[-2]
                if hint:
                    evolutions = []
                    hinted_evolution = diff.evolution()
                    temp_mutations = hinted_evolution.get(app_label, [])
                else:
                    evolutions = get_unapplied_evolutions(app, database)
                    temp_mutations = get_mutations(app, evolutions, database)

                mutations = [
                    mutation for mutation in temp_mutations
                    if mutation.is_mutable(app_label, database_sig,
                                           database)
                ]

                if mutations:
                    app_sql = ['-- Evolve application %s' % app_label]
                    evolution_required = True

                    for mutation in mutations:
                        # Only compile SQL if we want to show it
                        if compile_sql or execute:
                            app_sql.extend(
Ejemplo n.º 4
0
            diff = Diff(database_sig, current_proj_sig)
        except Evolution.DoesNotExist:
            print self.style.ERROR(
                "Can't evolve yet. Need to set an evolution baseline.")
            sys.exit(1)

        try:
            for app in app_list:
                app_label = app.__name__.split('.')[-2]
                if hint:
                    evolutions = []
                    hinted_evolution = diff.evolution()
                    mutations = hinted_evolution.get(app_label, [])
                else:
                    evolutions = get_unapplied_evolutions(app)
                    mutations = get_mutations(app, evolutions)

                if mutations:
                    app_sql = ['-- Evolve application %s' % app_label]
                    evolution_required = True
                    for mutation in mutations:
                        # Only compile SQL if we want to show it
                        if compile_sql or execute:
                            app_sql.extend(
                                mutation.mutate(app_label, database_sig))

                        # Now run the simulation, which will modify the signatures
                        try:
                            mutation.simulate(app_label, database_sig)
                        except CannotSimulate:
                            simulated = False