Пример #1
0
    def forwards(self, orm):
        
        # Deleting field 'Banner.custom_html'
        db.delete_column('banners_banner', 'custom_html')

        db.rename_column('banners_banner', 'image', 'banner_file')
        db.rename_column('banners_banner', 'destination', 'destination_url')
    def forwards(self, orm):
        # Deleting model 'DirectorsGenres'
        db.delete_table(u'directors_genres')

        # Deleting model 'MoviesGenres'
        db.delete_table(u'movies_genres')

        # Deleting model 'MoviesDirectors'
        db.delete_table(u'movies_directors')

        # Deleting model 'Directors'
        db.delete_table(u'directors')


        # Renaming column for 'Roles.movie_id' to match new field type.
        db.rename_column(u'roles', 'movie_id', 'movie_id_id')
        # Changing field 'Roles.movie_id'
        db.alter_column(u'roles', 'movie_id_id', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['step_game.Movies']))
        # Adding index on 'Roles', fields ['movie_id']
        db.create_index(u'roles', ['movie_id_id'])


        # Renaming column for 'Roles.actor_id' to match new field type.
        db.rename_column(u'roles', 'actor_id', 'actor_id_id')
        # Changing field 'Roles.actor_id'
        db.alter_column(u'roles', 'actor_id_id', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['step_game.Actors']))
        # Adding index on 'Roles', fields ['actor_id']
        db.create_index(u'roles', ['actor_id_id'])
    def forwards(self, orm):
        
        # Adding model 'FormValue'
        db.create_table('form_designer_formvalue', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('form_log', self.gf('django.db.models.fields.related.ForeignKey')(related_name='values', to=orm['form_designer.FormLog'])),
            ('field_name', self.gf('django.db.models.fields.SlugField')(max_length=255, db_index=True)),
            ('value', self.gf('picklefield.fields.PickledObjectField')(null=True, blank=True)),
        ))
        db.send_create_signal('form_designer', ['FormValue'])

        # Adding field 'FormLog.created_by'
        db.add_column('form_designer_formlog', 'created_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True), keep_default=False)

        db.rename_column('form_designer_formlog', 'data', 'tmp_data')
        from form_designer.models import FormLog
        from picklefield import PickledObjectField        
        tmp_data = PickledObjectField(null=True, blank=True)
        tmp_data.contribute_to_class(FormLog, 'tmp_data')

        for log in FormLog.objects.all():
            log.set_data(log.tmp_data)
            log.save()

        # Deleting field 'FormLog.data'
        db.delete_column('form_designer_formlog', 'tmp_data')
Пример #4
0
def rename_db_column(model_class, old_name, new_name):
    """ Renomear uma coluna de banco de dados do sensor. """
    table_name = model_class._meta.db_table
    db.start_transaction()
    db.rename_column(table_name, old_name, new_name) 
    logger.debug("Renamed column '%s' to '%s' on %s" % (old_name, new_name, table_name))
    db.commit_transaction()
Пример #5
0
 def test_dry_rename(self):
     """
     Test column renaming while --dry-run is turned on (should do nothing)
     See ticket #65
     """
     cursor = connection.cursor()
     db.create_table("test_drn", [('spam', models.BooleanField(default=False))])
     # Make sure we can select the column
     cursor.execute("SELECT spam FROM test_drn")
     # Rename it
     db.dry_run = True
     db.rename_column("test_drn", "spam", "eggs")
     db.dry_run = False
     cursor.execute("SELECT spam FROM test_drn")
     db.commit_transaction()
     db.start_transaction()
     try:
         cursor.execute("SELECT eggs FROM test_drn")
     except:
         pass
     else:
         self.fail("Dry-renamed new column could be selected!")
     db.rollback_transaction()
     db.delete_table("test_drn")
     db.start_transaction()
    def backwards(self, orm):
        # Removing unique constraint on 'Pais', fields ['nombre']
        db.delete_unique(u'clientes_pais', ['nombre'])

        # Removing unique constraint on 'Categoria', fields ['nombre']
        db.delete_unique(u'clientes_categoria', ['nombre'])

        # Removing unique constraint on 'Ciudad', fields ['nombre']
        db.delete_unique(u'clientes_ciudad', ['nombre'])

        # Removing index on 'Cliente', fields ['estado']
        db.delete_index(u'clientes_cliente', ['estado_id'])

        # Removing unique constraint on 'Cliente', fields ['nombre']
        db.delete_unique(u'clientes_cliente', ['nombre'])

        # Removing index on 'Cliente', fields ['ciudad']
        db.delete_index(u'clientes_cliente', ['ciudad_id'])

        # Removing unique constraint on 'Estado', fields ['nombre']
        db.delete_unique(u'clientes_estado', ['nombre'])

        # Deleting field 'Cliente.pais'
        db.delete_column(u'clientes_cliente', 'pais_id')


        # Renaming column for 'Cliente.ciudad' to match new field type.
        db.rename_column(u'clientes_cliente', 'ciudad_id', 'ciudad')
        # Changing field 'Cliente.ciudad'
        db.alter_column(u'clientes_cliente', 'ciudad', self.gf('django.db.models.fields.CharField')(max_length=50))

        # Renaming column for 'Cliente.estado' to match new field type.
        db.rename_column(u'clientes_cliente', 'estado_id', 'estado')
        # Changing field 'Cliente.estado'
        db.alter_column(u'clientes_cliente', 'estado', self.gf('django.db.models.fields.CharField')(max_length=50))
Пример #7
0
 def backwards(self, orm):
     db.drop_primary_key("cmsplugin_linkpublic")
     db.rename_column("cmsplugin_linkpublic", "cmspluginpublic_ptr_id", "publiccmsplugin_ptr_id")
     db.create_primary_key("cmsplugin_linkpublic", ("publiccmsplugin_ptr_id",))
     db.rename_table("cmsplugin_link", "link_link")
     db.rename_table("cmsplugin_linkpublic", "link_publiclink")
     db.alter_column('cmsplugin_link', 'public_id', orm['link.link:public'])
    def forwards(self, orm):
        db.start_transaction()
        # geom becomes geom_3d
        db.rename_column('l_t_troncon', 'geom', 'geom_3d')
        db.execute("ALTER TABLE l_t_troncon ALTER COLUMN geom_3d SET DEFAULT NULL;")
        # Create 2D topology
        db.add_column('l_t_troncon', 'geom',
                      self.gf('django.contrib.gis.db.models.fields.LineStringField')(srid=settings.SRID, default=GEOSGeometry('LINESTRING EMPTY'), spatial_index=False),
                      keep_default=False)
        # geom becomes geom_3d
        db.rename_column('e_t_evenement', 'geom', 'geom_3d')
        db.execute("ALTER TABLE e_t_evenement ALTER COLUMN geom_3d SET DEFAULT NULL;")
        # Create 2D topology
        db.add_column('e_t_evenement', 'geom',
                      self.gf('django.contrib.gis.db.models.fields.GeometryField')(srid=settings.SRID, null=True, default=None, spatial_index=False))
        # Switch cadastre to 2D
        db.alter_column('l_t_troncon', 'geom_cadastre', self.gf('django.contrib.gis.db.models.fields.LineStringField')(srid=settings.SRID, null=True, spatial_index=False))
        db.commit_transaction()

        #
        # Data migration
        #
        db.start_transaction()
        db.execute("UPDATE l_t_troncon SET geom = ST_force_2D(geom_3d);")
        db.execute("UPDATE e_t_evenement SET geom = ST_force_2D(geom_3d);")
        db.commit_transaction()
    def backwards(self, orm):
        db.delete_column('l_t_troncon', 'geom')
        db.rename_column('l_t_troncon', 'geom_3d', 'geom')
        db.delete_column('e_t_evenement', 'geom')
        db.rename_column('e_t_evenement', 'geom_3d', 'geom')

        db.alter_column('l_t_troncon', 'geom_cadastre', self.gf('django.contrib.gis.db.models.fields.LineStringField')(srid=settings.SRID, dim=3, null=True, spatial_index=False))
Пример #10
0
    def forwards(self, orm):
        # Renaming column 'item.type' to 'item.item_type'
        db.rename_column(u'items_item', 'type', 'item_type')

        # Update all sort field entries referring to 'type'
        for sort_field in SORT_FIELDS:
            orm.UserProfile.objects.filter(**{sort_field: 'type'}).update(**{sort_field: 'item_type'})
Пример #11
0
	def forwards(self, orm):
		# Adding model 'User'
		db.create_table('tomato_user', (
			('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
			('name', self.gf('django.db.models.fields.CharField')(max_length=20, unique=True)),
		))
		db.send_create_signal('tomato', ['User'])

		db.rename_column('tomato_element', 'owner', 'owner_str')

		db.rename_column('tomato_connection', 'owner', 'owner_str')

		db.add_column('tomato_element', 'owner',
					  self.gf('django.db.models.fields.related.ForeignKey')(related_name='elements', null=True, to=orm['tomato.User']),
					  keep_default=False)

		# Adding field 'Connection.owner'
		db.add_column('tomato_connection', 'owner',
					  self.gf('django.db.models.fields.related.ForeignKey')(related_name='connections', null=True, to=orm['tomato.User']),
					  keep_default=False)

		db.add_column('tomato_network', 'owner',
					  self.gf('django.db.models.fields.related.ForeignKey')(related_name='networks', null=True, to=orm['tomato.User']),
					  keep_default=False)

		db.add_column('tomato_template', 'owner',
					  self.gf('django.db.models.fields.related.ForeignKey')(related_name='templates', null=True, to=orm['tomato.User']),
					  keep_default=False)

		# Changing field 'OpenVZ.template'
		db.alter_column('tomato_openvz', 'template_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['tomato.Template'], null=True))
    def backwards(self, orm):
        # Removing index on 'Representative', fields ['faction']
        db.delete_index('representative_representative', ['faction_id'])

        # Deleting model 'Faction'
        db.delete_table('representative_faction')

        # Adding field 'Representative.faction_en'
        db.add_column('representative_representative', 'faction_en',
                      self.gf('django.db.models.fields.TextField')(null=True, blank=True),
                      keep_default=False)

        # Adding field 'Representative.faction_ka'
        db.add_column('representative_representative', 'faction_ka',
                      self.gf('django.db.models.fields.TextField')(null=True, blank=True),
                      keep_default=False)


        # Renaming column for 'Representative.faction' to match new field type.
        db.rename_column('representative_representative', 'faction_id', 'faction')
        # Changing field 'Representative.faction'
        db.alter_column('representative_representative', 'faction', self.gf('django.db.models.fields.TextField')(null=True))
        # Adding M2M table for field parties on 'Cabinet'
        m2m_table_name = db.shorten_name('representative_cabinet_parties')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('cabinet', models.ForeignKey(orm['representative.cabinet'], null=False)),
            ('party', models.ForeignKey(orm['representative.party'], null=False))
        ))
        db.create_unique(m2m_table_name, ['cabinet_id', 'party_id'])

        # Removing M2M table for field factions on 'Cabinet'
        db.delete_table(db.shorten_name('representative_cabinet_factions'))
    def forwards(self, orm):
        # Adding model 'Faction'
        db.create_table('representative_faction', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)),
            ('short', self.gf('django.db.models.fields.CharField')(max_length=32, null=True)),
        ))
        db.send_create_signal('representative', ['Faction'])

        # Deleting field 'Representative.faction_en'
        db.delete_column('representative_representative', 'faction_en')

        # Deleting field 'Representative.faction_ka'
        db.delete_column('representative_representative', 'faction_ka')


        # Renaming column for 'Representative.faction' to match new field type.
        db.rename_column('representative_representative', 'faction', 'faction_id')
        # Changing field 'Representative.faction'
        db.alter_column('representative_representative', 'faction_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['representative.Faction']))
        # Adding index on 'Representative', fields ['faction']
        db.create_index('representative_representative', ['faction_id'])

        # Removing M2M table for field parties on 'Cabinet'
        db.delete_table(db.shorten_name('representative_cabinet_parties'))

        # Adding M2M table for field factions on 'Cabinet'
        m2m_table_name = db.shorten_name('representative_cabinet_factions')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('cabinet', models.ForeignKey(orm['representative.cabinet'], null=False)),
            ('faction', models.ForeignKey(orm['representative.faction'], null=False))
        ))
        db.create_unique(m2m_table_name, ['cabinet_id', 'faction_id'])
    def backwards(self, orm):

        # Adding field 'Phase.judging_close'
        db.add_column(
            "competition_phase",
            "judging_close",
            self.gf("django.db.models.fields.DateTimeField")(default=datetime.datetime.now),
            keep_default=False,
        )

        # Adding field 'Phase.applications_open'
        db.add_column(
            "competition_phase",
            "applications_open",
            self.gf("django.db.models.fields.DateTimeField")(default=datetime.datetime.now),
            keep_default=False,
        )

        # Adding field 'Phase.applications_close_judging_open'
        db.rename_column("competition_phase", "online_applications_due", "applications_close_judging_open")

        # Deleting field 'Phase.applications_due'
        db.delete_column("competition_phase", "applications_due")

        # Changing field 'Phase.name'
        db.alter_column("competition_phase", "name", self.gf("django.db.models.fields.CharField")(max_length=500))
    def backwards(self, orm):
        # Adding field 'OutputSettings.daily_states_filename'
        db.add_column('ScenarioCreator_outputsettings', 'daily_states_filename',
                      self.gf('django.db.models.fields.CharField')(max_length=255, blank=True, null=True),
                      keep_default=False)

        # Adding field 'OutputSettings.maximum_iterations_for_daily_output'
        db.add_column('ScenarioCreator_outputsettings', 'maximum_iterations_for_daily_output',
                      self.gf('django.db.models.fields.PositiveIntegerField')(default=3, blank=True, null=True),
                      keep_default=False)

        # Adding field 'OutputSettings.save_all_daily_outputs'
        db.add_column('ScenarioCreator_outputsettings', 'save_all_daily_outputs',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'OutputSettings.map_directory'
        db.add_column('ScenarioCreator_outputsettings', 'map_directory',
                      self.gf('django.db.models.fields.CharField')(max_length=255, blank=True, null=True),
                      keep_default=False)

        # Adding field 'OutputSettings.write_map_output'
        db.rename_column('ScenarioCreator_outputsettings', 'save_map_output', 'write_map_output' )

        # Deleting field 'OutputSettings.save_daily_unit_states'
        db.delete_column('ScenarioCreator_outputsettings', 'save_daily_unit_states')
    def forwards(self, orm):

        if was_applied(__file__, 'catalogue'):
            return

        # Renaming field 'Partie.parente'
        db.rename_column('catalogue_partie', 'parente_id', 'parent_id')
    def backwards(self, orm):
        # Adding index on 'Tag', fields ['tipo_tags']
        db.create_index(u"usuario_tag", ["tipo_tags_id"])

        # Adding model 'Tipo_Tag'
        db.create_table(
            u"usuario_tipo_tag",
            (
                ("tabela", self.gf("django.db.models.fields.CharField")(max_length=100)),
                (u"id", self.gf("django.db.models.fields.AutoField")(primary_key=True)),
                ("tipo", self.gf("django.db.models.fields.CharField")(max_length=100)),
            ),
        )
        db.send_create_signal(u"usuario", ["Tipo_Tag"])

        # Removing M2M table for field comcopia on 'Tag'
        db.delete_table(db.shorten_name(u"usuario_tag_comcopia"))

        # Renaming column for 'Tag.tipo_tags' to match new field type.
        db.rename_column(u"usuario_tag", "tipo_tags", "tipo_tags_id")
        # Changing field 'Tag.tipo_tags'
        db.alter_column(
            u"usuario_tag",
            "tipo_tags_id",
            self.gf("django.db.models.fields.related.ForeignKey")(to=orm["usuario.Tipo_Tag"]),
        )
    def forwards(self, orm):

        # Renaming column for 'iSCSITarget.iscsi_target_portalgroup' to match new field type.
        db.rename_column("services_iscsitarget", "iscsi_target_portalgroup", "iscsi_target_portalgroup_id")
        # Changing field 'iSCSITarget.iscsi_target_portalgroup'
        db.alter_column(
            "services_iscsitarget",
            "iscsi_target_portalgroup_id",
            self.gf("django.db.models.fields.related.ForeignKey")(to=orm["services.iSCSITargetPortal"]),
        )

        # Adding index on 'iSCSITarget', fields ['iscsi_target_portalgroup']
        db.create_index("services_iscsitarget", ["iscsi_target_portalgroup_id"])

        # Renaming column for 'iSCSITarget.iscsi_target_initiatorgroup' to match new field type.
        db.rename_column("services_iscsitarget", "iscsi_target_initiatorgroup", "iscsi_target_initiatorgroup_id")
        # Changing field 'iSCSITarget.iscsi_target_initiatorgroup'
        db.alter_column(
            "services_iscsitarget",
            "iscsi_target_initiatorgroup_id",
            self.gf("django.db.models.fields.related.ForeignKey")(to=orm["services.iSCSITargetAuthorizedInitiator"]),
        )

        # Adding index on 'iSCSITarget', fields ['iscsi_target_initiatorgroup']
        db.create_index("services_iscsitarget", ["iscsi_target_initiatorgroup_id"])
    def forwards(self, orm):
        
        # Changing field 'InstitutionDetails.number_id'
        db.alter_column('edumanage_institutiondetails', 'number_id', self.gf('django.db.models.fields.PositiveIntegerField')(max_length=6, null=True, blank=True))

        # Deleting field 'InstRealmMon.instid'
        db.delete_column('edumanage_instrealmmon', 'instid_id')

        # Renaming column for 'InstRealmMon.realm' to match new field type.
        db.rename_column('edumanage_instrealmmon', 'realm', 'realm_id')
        # Changing field 'InstRealmMon.realm'
        # WORKAROUND NEEDED
        # This migration breaks with PostgreSQL with:
        #   ERROR:  column "realm_id" cannot be cast automatically to type integer
        #   HINT:  Specify a USING expression to perform the conversion.
        #   STATEMENT:  ALTER TABLE "edumanage_instrealmmon" ALTER COLUMN "realm_id" TYPE integer,
        #          ALTER COLUMN "realm_id" SET NOT NULL, ALTER COLUMN "realm_id" DROP DEFAULT;
        # This is a known problem: http://south.aeracode.org/ticket/484
        # (PostgreSQL will not automatically convert and conversion must be provided with the USING clause)
        # Workaround: For PostgreSQL invoke a direct SQL statement amended with a USING clause to do the converion explicitly.
        # Credits:
        # * http://codeinthehole.com/writing/altering-postgres-table-columns-with-south/
        # * http://stackoverflow.com/questions/13170570/change-type-of-varchar-field-to-integer-cannot-be-cast-automatically-to-type-i
        if ( db._get_connection().vendor == "postgresql" ):
            db.execute('ALTER TABLE "edumanage_instrealmmon" ALTER COLUMN "realm_id" TYPE integer USING (trim(realm_id)::integer), ALTER COLUMN "realm_id" SET NOT NULL, ALTER COLUMN "realm_id" DROP DEFAULT;')
        else:
            db.alter_column('edumanage_instrealmmon', 'realm_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['edumanage.InstRealm']))

        # Adding index on 'InstRealmMon', fields ['realm']
        db.create_index('edumanage_instrealmmon', ['realm_id'])

        # Changing field 'InstRealmMon.mon_type'
        db.alter_column('edumanage_instrealmmon', 'mon_type', self.gf('django.db.models.fields.CharField')(max_length=16))
    def forwards(self, orm):
        
        # Renaming field 'Personne.mobile'
        db.rename_column('chercheurs_personne', 'mobile', 'telephone')

        # Adding field 'Personne.adresse_postale'
        db.add_column('chercheurs_personne', 'adresse_postale', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
    def backwards(self, orm):

        # Removing index on 'iSCSITarget', fields ['iscsi_target_initiatorgroup']
        db.delete_index("services_iscsitarget", ["iscsi_target_initiatorgroup_id"])

        # Removing index on 'iSCSITarget', fields ['iscsi_target_portalgroup']
        db.delete_index("services_iscsitarget", ["iscsi_target_portalgroup_id"])

        # Renaming column for 'iSCSITarget.iscsi_target_portalgroup' to match new field type.
        db.rename_column("services_iscsitarget", "iscsi_target_portalgroup_id", "iscsi_target_portalgroup")
        # Changing field 'iSCSITarget.iscsi_target_portalgroup'
        db.alter_column(
            "services_iscsitarget",
            "iscsi_target_portalgroup",
            self.gf("django.db.models.fields.IntegerField")(max_length=120),
        )

        # Renaming column for 'iSCSITarget.iscsi_target_initiatorgroup' to match new field type.
        db.rename_column("services_iscsitarget", "iscsi_target_initiatorgroup_id", "iscsi_target_initiatorgroup")
        # Changing field 'iSCSITarget.iscsi_target_initiatorgroup'
        db.alter_column(
            "services_iscsitarget",
            "iscsi_target_initiatorgroup",
            self.gf("django.db.models.fields.IntegerField")(max_length=120),
        )
    def backwards(self, orm):
        # Removing index on 'Volume', fields ['lieu']
        db.delete_index(u'volume', ['lieu_id'])

        # Adding model 'TestViewOaiRecords'
        db.create_table(u'test_view_oai_records', (
            ('type_notice', self.gf('django.db.models.fields.BigIntegerField')()),
            ('publisher', self.gf('django.db.models.fields.CharField')(max_length=765)),
            ('titre', self.gf('django.db.models.fields.CharField')(max_length=765, blank=True)),
            ('id_loris', self.gf('django.db.models.fields.CharField')(max_length=15)),
            ('parent', self.gf('django.db.models.fields.IntegerField')()),
            ('titre_parent', self.gf('django.db.models.fields.CharField')(max_length=765, blank=True)),
            ('fin_parent', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
            ('debut_parent', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
            ('time_stamp', self.gf('django.db.models.fields.DateTimeField')()),
            ('type_event', self.gf('django.db.models.fields.CharField')(max_length=12, blank=True)),
            ('id', self.gf('django.db.models.fields.CharField')(max_length=48, primary_key=True)),
            ('date_fin', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
            ('place', self.gf('django.db.models.fields.CharField')(max_length=384)),
            ('supprime', self.gf('django.db.models.fields.IntegerField')()),
            ('date_pub', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
            ('confidentialite', self.gf('django.db.models.fields.CharField')(max_length=33)),
            ('oai_set', self.gf('django.db.models.fields.CharField')(max_length=21)),
            ('date_debut', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
            ('sous_titre', self.gf('django.db.models.fields.CharField')(max_length=384)),
        ))
        db.send_create_signal('old', ['TestViewOaiRecords'])


        # Renaming column for 'Volume.lieu' to match new field type.
        db.rename_column(u'volume', 'lieu_id', 'lieu')
        # Changing field 'Volume.lieu'
        db.alter_column(u'volume', 'lieu', self.gf('django.db.models.fields.IntegerField')())
    def backwards(self, orm):
        try:
            # Removing index on 'PricingObject', fields ['type']
            db.delete_index(u'ralph_scrooge_pricingobject', ['type_id'])
        except utils.DatabaseError:
            pass

        # Removing unique constraint on 'TeamManager', fields ['manager', 'team']
        db.delete_unique(u'ralph_scrooge_teammanager', ['manager_id', 'team_id'])

        # Deleting model 'PricingObjectType'
        db.delete_table(u'ralph_scrooge_pricingobjecttype')

        # Deleting model 'PricingObjectModel'
        db.delete_table(u'ralph_scrooge_pricingobjectmodel')

        # Deleting model 'TeamManager'
        db.delete_table(u'ralph_scrooge_teammanager')

        # Adding field 'AssetInfo.model'
        db.rename_column(u'ralph_scrooge_assetinfo', 'model_old_id', 'model_id')

        # Adding field 'PricingObject.color'
        db.add_column(u'ralph_scrooge_pricingobject', 'color',
                      self.gf('django.db.models.fields.PositiveIntegerField')(default=255),
                      keep_default=False)

        # Deleting field 'PricingObject.model'
        db.delete_column(u'ralph_scrooge_pricingobject', 'model_id')

        # Renaming column for 'PricingObject.type' to match new field type.
        db.rename_column(u'ralph_scrooge_pricingobject', 'type_id', 'type')
        # Changing field 'PricingObject.type'
        db.alter_column(u'ralph_scrooge_pricingobject', 'type', self.gf('django.db.models.fields.PositiveIntegerField')())
    def forwards(self, orm):
        # Renaming field 'Prize.deprecated_provided' to 'Prize.provided'
        db.rename_column(u'tracker_prize', 'deprecated_provided', 'provided')

        # Adding field 'Prize.creator'
        db.add_column(u'tracker_prize', 'creator',
                      self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
                      keep_default=False)

        # Adding field 'Prize.creatoremail'
        db.add_column(u'tracker_prize', 'creatoremail',
                      self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
                      keep_default=False)

        # Adding field 'Prize.creatorwebsite'
        db.add_column(u'tracker_prize', 'creatorwebsite',
                      self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
                      keep_default=False)

        # Adding field 'Prize.state'
        db.add_column(u'tracker_prize', 'state',
                      self.gf('django.db.models.fields.CharField')(default='PENDING', max_length=32),
                      keep_default=False)

        # Removing M2M table for field contributors on 'Prize'
        db.delete_table(db.shorten_name(u'tracker_prize_contributors'))

        # Deleting field 'Donor.prizecontributorwebsite'
        db.delete_column(u'tracker_donor', 'prizecontributorwebsite')

        # Deleting field 'Donor.prizecontributoremail'
        db.delete_column(u'tracker_donor', 'prizecontributoremail')
    def backwards(self, orm):
        # Removing index on 'Restaurant', fields ['location']
        db.delete_index(u'api_restaurant', ['location_id'])

        # Adding model 'Restaurant_Holiday'
        db.create_table(u'api_restaurant_holiday', (
            ('closed_date', self.gf('django.db.models.fields.DateTimeField')()),
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('restaurant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['api.Restaurant'])),
        ))
        db.send_create_signal(u'api', ['Restaurant_Holiday'])

        # Deleting model 'RestaurantOpenHours'
        db.delete_table(u'api_restaurantopenhours')

        # Deleting model 'RestaurantHoliday'
        db.delete_table(u'api_restaurantholiday')

        # Deleting model 'Location'
        db.delete_table(u'api_location')

        # Adding field 'Restaurant.closed_every_other_weekend_initial_weekend'
        db.add_column(u'api_restaurant', 'closed_every_other_weekend_initial_weekend',
                      self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True),
                      keep_default=False)

        # Deleting field 'Restaurant.closed_every_other_weekend_initial_weekend_sat'
        db.delete_column(u'api_restaurant', 'closed_every_other_weekend_initial_weekend_sat')


        # Renaming column for 'Restaurant.location' to match new field type.
        db.rename_column(u'api_restaurant', 'location_id', 'location')
        # Changing field 'Restaurant.location'
        db.alter_column(u'api_restaurant', 'location', self.gf('django.db.models.fields.IntegerField')())
    def backwards(self, orm):
        # Removing index on 'Sponsor', fields ['organization']
        db.delete_index(u'sponsor_sponsor', ['organization_id'])

        # Deleting model 'Organization'
        db.delete_table(u'sponsor_organization')

        # Adding field 'Sponsor.name_user'
        db.add_column(u'sponsor_sponsor', 'name_user',
                      self.gf('django.db.models.fields.CharField')(default=1, max_length=50),
                      keep_default=False)

        # Adding field 'Sponsor.join_date'
        db.add_column(u'sponsor_sponsor', 'join_date',
                      self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=1, blank=True),
                      keep_default=False)

        # Adding field 'Sponsor.password'
        db.add_column(u'sponsor_sponsor', 'password',
                      self.gf('django.db.models.fields.CharField')(default=1, max_length=50),
                      keep_default=False)

        # Adding field 'Sponsor.email'
        db.add_column(u'sponsor_sponsor', 'email',
                      self.gf('django.db.models.fields.EmailField')(default=1, max_length=75, unique=True),
                      keep_default=False)

        # Deleting field 'Sponsor.user'
        db.delete_column(u'sponsor_sponsor', 'user_id')


        # Renaming column for 'Sponsor.organization' to match new field type.
        db.rename_column(u'sponsor_sponsor', 'organization_id', 'organization')
        # Changing field 'Sponsor.organization'
        db.alter_column(u'sponsor_sponsor', 'organization', self.gf('django.db.models.fields.CharField')(max_length=50))
    def backwards(self, orm):
        # Renaming field 'Prize.provided' to 'Prize.deprecated_provided'
        db.rename_column(u'tracker_prize', 'provided', 'deprecated_provided')

        # Deleting field 'Prize.creator'
        db.delete_column(u'tracker_prize', 'creator')

        # Deleting field 'Prize.creatoremail'
        db.delete_column(u'tracker_prize', 'creatoremail')

        # Deleting field 'Prize.creatorwebsite'
        db.delete_column(u'tracker_prize', 'creatorwebsite')

        # Deleting field 'Prize.state'
        db.delete_column(u'tracker_prize', 'state')

        # Adding M2M table for field contributors on 'Prize'
        m2m_table_name = db.shorten_name(u'tracker_prize_contributors')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('prize', models.ForeignKey(orm['tracker.prize'], null=False)),
            ('donor', models.ForeignKey(orm['tracker.donor'], null=False))
        ))
        db.create_unique(m2m_table_name, ['prize_id', 'donor_id'])

        # Adding field 'Donor.prizecontributorwebsite'
        db.add_column(u'tracker_donor', 'prizecontributorwebsite',
                      self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True),
                      keep_default=False)

        # Adding field 'Donor.prizecontributoremail'
        db.add_column(u'tracker_donor', 'prizecontributoremail',
                      self.gf('django.db.models.fields.EmailField')(unique=True, max_length=128, null=True, blank=True),
                      keep_default=False)
Пример #28
0
 def forwards(self, orm):    
     db.rename_table("text_text", "cmsplugin_text")
     db.rename_table("text_publictext", "cmsplugin_textpublic")
     db.alter_column('cmsplugin_text', 'public_id', orm['text.text:public'])
     db.drop_primary_key("cmsplugin_textpublic")
     db.rename_column("cmsplugin_textpublic", "publiccmsplugin_ptr_id", "cmspluginpublic_ptr_id")
     db.create_primary_key("cmsplugin_textpublic", ("cmspluginpublic_ptr_id",))
    def forwards(self, orm):

        # Renaming field 'State.date' to 'State.captured_at'
        db.rename_column('greenhub_state', 'date', 'captured_at')

        # Changing field 'Message.data'
        db.alter_column('greenhub_message', 'data', self.gf('django.db.models.fields.CharField')(max_length=1000))
    def backwards(self, orm):
        
        # Renaming field 'Personne.telephone'
        db.rename_column('chercheurs_personne', 'telephone', 'mobile')

        # Deleting field 'Personne.adresse_postale'
        db.delete_column('chercheurs_personne', 'adresse_postale')
 def backwards(self, orm):
     
     db.rename_column('maps_layer', 'keywords_temp', 'keywords')
 def forwards(self, orm):
     # Renaming field 'Unit.parent_hierarchique'
     db.rename_column(u'units_unit', 'parent_herachique_id',
                      'parent_hierarchique_id')
Пример #33
0
 def forwards(self, orm):
     db.rename_column(u'exercises_category', 'elegible_for_demos',
                      'eligible_for_demos')
Пример #34
0
    def forwards(self, orm):

        # Deleting field 'FoiMessage.recipient'
        db.rename_column('foirequest_foimessage', 'recipient',
                         'recipient_email')
Пример #35
0
 def backwards(self, orm):
     db.delete_unique('zinnia_entry_authors', ['entry_id', 'author_id'])
     db.rename_column('zinnia_entry_authors', 'author_id', 'user_id')
     db.create_unique('zinnia_entry_authors', ['entry_id', 'user_id'])
 def forwards(self, orm):
     db.rename_column('issues_milestone', 'due_date', 'deadline')
 def forwards(self, orm):
     
     # Move aside keywords column temporarily
     db.rename_column('maps_layer', 'keywords', 'keywords_temp')
Пример #38
0
 def backwards(self, orm):
     db.rename_column('publicbody_publicbody', 'topic_name', 'topic')
     # Deleting model 'PublicBodyTopic'
     db.delete_table('publicbody_publicbodytopic')
Пример #39
0
 def forwards(self, orm):
     db.rename_column('sharing_afp_share', 'afp_noadouble', 'afp_adouble')
     orm.AFP_Share.objects.all().update(
         afp_adouble=not models.F('afp_adouble'))
 def backwards(self, orm):
     db.rename_column('m_t_chantier', 'cout_global', 'cout')
Пример #41
0
 def backwards(self, orm):
     db.rename_column('askbot_anonymousanswer', 'question_id',
                      'question_post_id')
Пример #42
0
 def backwards(self, orm):
     db.rename_table(u'oauth_provider_scope', u'oauth_provider_resource')
     db.rename_column(u'oauth_provider_token', u'scope_id', u'resource_id')
     db.send_create_signal(u'oauth_provider', [u'Resource'])
 def forwards(self, orm):
     db.rename_column('Document', 'documentUUID', 'id')
    def forwards(self, orm):
        # Adding model 'MessageServer'
        db.create_table('server_messageserver', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('text', self.gf('django.db.models.fields.TextField')(null=True,
                                                                  blank=True)),
            ('date',
             self.gf('django.db.models.fields.DateTimeField')(blank=True)),
        ))
        db.send_create_signal('server', ['MessageServer'])

        # Adding model 'Migration'
        db.create_table('server_migration', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('computer', self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['server.Computer'])),
            ('version', self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['server.Version'])),
            ('date',
             self.gf('django.db.models.fields.DateTimeField')(blank=True)),
        ))
        db.send_create_signal('server', ['Migration'])

        #insert Migrations
        qry = Update.objects.values('computer',
                                    'version').annotate(date=Min('date'))
        for q in qry:
            o_migration = Mig()
            o_migration.computer_id = q.get('computer')
            o_migration.version_id = q.get('version')
            o_migration.date = q.get('date')
            o_migration.save()

        # Adding model 'Platform'
        db.create_table('server_platform', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(
                max_length=50, unique=True, null=True, blank=True)),
        ))
        db.send_create_signal('server', ['Platform'])

        #insert Platforms
        o_Platform = Platform()
        o_Platform.id = 1
        o_Platform.name = "Windows"
        o_Platform.save()

        o_Platform = Platform()
        o_Platform.id = 2
        o_Platform.name = "Linux"
        o_Platform.save()

        # Adding model 'Notification'
        db.create_table('server_notification', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('date',
             self.gf('django.db.models.fields.DateTimeField')(blank=True)),
            ('notification', self.gf('django.db.models.fields.TextField')(
                null=True, blank=True)),
            ('checked',
             self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal('server', ['Notification'])

        # Deleting field 'Property.after_insert'
        db.delete_column('server_property', 'after_insert')

        # Deleting field 'Property.before_insert'
        db.delete_column('server_property', 'before_insert')

        # Renaming column for 'Version.platform' to match new field type.
        db.rename_column('server_version', 'platform', 'platform_id')
        # Changing field 'Version.platform'
        db.alter_column(
            'server_version', 'platform_id',
            self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['server.Platform']))
        # Adding index on 'Version', fields ['platform']
        db.create_index('server_version', ['platform_id'])

        # Adding field 'Computer.datehardware'
        db.add_column(
            'server_computer',
            'datehardware',
            self.gf('django.db.models.fields.DateTimeField')(null=True),
            keep_default=False)

        # Adding field 'Checking.alert'
        db.add_column(
            'server_checking',
            'alert',
            self.gf('django.db.models.fields.BooleanField')(default=True),
            keep_default=False)

        # Changing field 'Update.version'
        db.alter_column(
            'server_update', 'version_id',
            self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['server.Version'], null=True))

        # Changing field 'Message.text'
        db.alter_column(
            'server_message', 'text',
            self.gf('django.db.models.fields.TextField')(null=True))

        # Changing field 'UserProfile.version'
        db.alter_column(
            'server_userprofile', 'version_id',
            self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['server.Version'], null=True))
Пример #45
0
            try:
                db.execute(
                    'ALTER TABLE easy_thumbnails_source ADD CONSTRAINT '
                    'sourcestorage_id_fk_to_storage FOREIGN KEY (storage_id) '
                    'REFERENCES easy_thumbnails_storage(id)')
            except Exception, e:
                print "Could not add contraint: %s" % e

        if using_mysql:
            try:
                db.drop_foreign_key('easy_thumbnails_thumbnail',
                                    'storage_new_id')
            except ValueError, e:
                # e.g MyISAM tables don't support foreign key constraints
                print "Could not remove foreign key contraint: %s" % e
        db.rename_column('easy_thumbnails_thumbnail', 'storage_new_id',
                         'storage_id')
        if using_mysql:
            try:
                db.execute(
                    'ALTER TABLE easy_thumbnails_thumbnail ADD CONSTRAINT '
                    'thumbnailstorage_id_fk_to_storage FOREIGN KEY (storage_id) '
                    'REFERENCES easy_thumbnails_storage(id)')
            except Exception, e:
                print "Could not add contraint: %s" % e

    def backwards(self, orm):
        db.rename_table('easy_thumbnails_storage',
                        'easy_thumbnails_storagenew')
        db.rename_column('easy_thumbnails_source', 'storage_id',
                         'storage_new_id')
        db.rename_column('easy_thumbnails_thumbnail', 'storage_id',
Пример #46
0
 def forwards(self, orm):
     db.rename_column(u'ilsgateway_supplypointstatus', 'supply_point', 'location_id')
     db.rename_column(u'ilsgateway_alert', 'supply_point', 'location_id')
     db.rename_column(u'ilsgateway_deliverygroupreport', 'supply_point', 'location_id')
     db.rename_column(u'ilsgateway_organizationsummary', 'supply_point', 'location_id')
     db.rename_column(u'ilsgateway_productavailabilitydata', 'supply_point', 'location_id')
 def forwards(self, orm):
     db.rename_column(u'directoryservice_activedirectory', 'ad_netbiosname',
                      'ad_netbiosname_a')
 def backwards(self, orm):
     db.rename_column('Document', 'id', 'documentUUID')
Пример #49
0
 def forwards(self, orm):
     db.rename_column('polls_poll', 'seen_ips', 'ips_seen')
    def forwards(self, orm):

        db.rename_column('cmsplugin_filerimage', 'float', 'alignment')
    def forwards(self, orm):

        db.rename_column('city_city', 'site_one_id', 'site_id')        
Пример #52
0
 def forwards(self, orm):
     db.rename_column('panda_dataset', 'related_stories', 'related_links')
Пример #53
0
    def backwards(self, orm):

        db.rename_column('issues_event', 'value', 'text')
Пример #54
0
 def backwards(self, orm):
     db.rename_column('polls_poll', 'ips_seen', 'seen_ips')
Пример #55
0
 def forwards(self, orm):
     db.rename_column('eway_ewaytransaction', 'txn_ref', 'transaction_id')
     db.rename_column('eway_ewaytransaction', 'txn_url', 'request_url')
     db.rename_column('eway_ewaytransaction', 'txn_method', 'method')
Пример #56
0
 def forwards(self, orm):
     # Deleting field 'Event.text'
     db.rename_column('issues_event', 'text', 'value')
Пример #57
0
    def forwards(self, orm):
        # Deleting model 'ImportEvent'
        db.delete_table(u'treemap_importevent')

        # Adding model 'MapFeature'
        db.create_table(u'treemap_mapfeature', (
            (u'id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('udfs', self.gf('treemap.udf.UDFField')(db_index=True,
                                                     blank=True)),
            ('instance', self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm['treemap.Instance'])),
            ('geom', self.gf('django.contrib.gis.db.models.fields.PointField')(
                srid=3857, db_column=u'the_geom_webmercator')),
            ('address_street', self.gf('django.db.models.fields.CharField')(
                max_length=255, null=True, blank=True)),
            ('address_city', self.gf('django.db.models.fields.CharField')(
                max_length=255, null=True, blank=True)),
            ('address_zip', self.gf('django.db.models.fields.CharField')(
                max_length=30, null=True, blank=True)),
            ('readonly',
             self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('feature_type',
             self.gf('django.db.models.fields.CharField')(max_length=255)),
        ))
        db.send_create_signal(u'treemap', ['MapFeature'])

        # Manual insertion by RM to move data and set auto-increment value
        db.execute("""
INSERT INTO treemap_mapfeature
     ( id, udfs, feature_type, instance_id, the_geom_webmercator, address_street, address_city, address_zip, readonly )
SELECT id, udfs, 'Plot'      , instance_id, the_geom_webmercator, address_street, address_city, address_zip, readonly
FROM treemap_plot;
         """)

        db.execute(
            "select setval('treemap_mapfeature_id_seq', (select max(id) from treemap_plot));"
        )

        # Deleting field 'Tree.import_event'
        db.delete_column(u'treemap_tree', 'import_event_id')

        # Deleting field 'Plot.import_event'
        db.delete_column(u'treemap_plot', 'import_event_id')

        # Deleting field 'Plot.udfs'
        db.delete_column(u'treemap_plot', 'udfs')

        # Deleting field 'Plot.address_street'
        db.delete_column(u'treemap_plot', 'address_street')

        # Deleting field 'Plot.address_zip'
        db.delete_column(u'treemap_plot', 'address_zip')

        # Deleting field 'Plot.address_city'
        db.delete_column(u'treemap_plot', 'address_city')

        # Deleting field 'Plot.instance'
        db.delete_column(u'treemap_plot', 'instance_id')

        # Deleting field 'Plot.readonly'
        db.delete_column(u'treemap_plot', 'readonly')

        # Deleting field 'Plot.geom'
        db.delete_column(u'treemap_plot', u'the_geom_webmercator')

        # Renaming field 'Plot.id' to 'Plot.mapfeature_id
        db.rename_column(u'treemap_plot', u'id', u'mapfeature_ptr_id')
        db.alter_column(
            u'treemap_plot', u'mapfeature_ptr_id',
            self.gf('django.db.models.fields.related.OneToOneField')(
                default=0,
                to=orm['treemap.MapFeature'],
                unique=True,
                primary_key=True))
 def forwards(self, orm):
     db.rename_column('order_communicationevent', 'date', 'date_created')
     db.rename_column('order_shippingevent', 'date', 'date_created')
     db.rename_column('order_paymentevent', 'date', 'date_created')
    def backwards(self, orm):
        # Renaming field 'Article.created' to 'Article.created_on'
        db.rename_column('news_article', 'created', 'created_on')

        # Deleting field 'Article.modified'
        db.delete_column('news_article', 'modified')
 def forwards(self, orm):
     db.rename_column('mirrors_mirror', 'country', 'country_old')
     db.rename_column('mirrors_mirrorurl', 'country', 'country_old')