postgresql

On 14/09/06, Derek Anderson <[EMAIL PROTECTED]> wrote:
>
> which backend are you using?
>
> Matthew Flanagan wrote:
> > Derek,
> >
> > I have manually merged the trunk into my local working copy of the
> > schema-evolution branch and started playing with it. I wanted to
> > question the SQL "sqlevolve" is outputting. I have this model in an
> > application called "asset":
> >
> > class Interface(models.Model):
> >     name = models.CharField(maxlength=64, core=True, db_index=True,
> >         help_text='The name of the interface as given by the asset.')
> >     interfacetype = models.ForeignKey(InterfaceType)
> >     ipaddress = models.ForeignKey(IPAddress, verbose_name='IP Address',
> >         raw_id_admin=True)
> >     # allow for EUI-48 and EUI-64 addresses
> >     mac_address = models.CharField(maxlength=24, blank=True,
> >         help_text='The EUI-48 or EUI-64 physical address of the interface.')
> >     domain = models.CharField(maxlength=255, blank=True,
> >         help_text='The DNS domain this host resides in.')
> >     asset = models.ForeignKey(Asset, edit_inline=models.TABULAR,
> >         num_in_admin=10, num_extra_on_change=5)
> >     objects = InterfaceManager()
> >
> >     def _get_meta(self):
> >         return self._meta
> >     meta = property(_get_meta)
> >
> >     def __str__(self):
> >         return "%s:%s" % (self.asset, self.name)
> >
> >     def get_absolute_url(self):
> >         return self.asset.get_absolute_url()
> >
> >     class Meta:
> >         ordering = ['name']
> >         unique_together = (('asset', 'name'),)
> >
> >     class Admin:
> >         pass
> >
> > and the schema from "./manage.py sql asset":
> >
> > CREATE TABLE "asset_interface" (
> >     "id" serial NOT NULL PRIMARY KEY,
> >     "name" varchar(64) NOT NULL,
> >     "interfacetype_id" integer NOT NULL,
> >     "ipaddress_id" integer NOT NULL REFERENCES "ip_ipaddress" ("id"),
> >     "mac_address" varchar(24) NOT NULL,
> >     "domain" varchar(255) NOT NULL,
> >     "asset_id" integer NOT NULL REFERENCES "asset_asset" ("id"),
> >     UNIQUE ("asset_id", "name")
> > );
> >
> >
> > when I run "./manage.py sqlevolve asset" with absolutely no changes to
> > my models it outputs:
> >
> > BEGIN;
> > ALTER TABLE "asset_interface" ADD COLUMN "name_tmp" varchar(64);
> > UPDATE "asset_interface" SET "name_tmp" = "name";
> > ALTER TABLE "asset_interface" DROP COLUMN "name";
> > ALTER TABLE "asset_interface" RENAME COLUMN "name_tmp" TO "name";
> > ALTER TABLE "asset_interface" ALTER COLUMN "name" SET NOT NULL;
> > COMMIT;
> >
> >
> > Any ideas why it is doing this?
> >
> > regards
> >
> > matthew
> >
> > >
> >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to