I'm trying to generate a new database with uuid using django and postgresql
I have a model with UUID field like this :
class BaseUser(AbstractBaseUser):
id = models.UUIDField(_('id'), primary_key=True, default=uuid.uuid4, editable=False)
When i try to syncdb i got the following error :
django.db.utils.ProgrammingError: column "id" cannot be cast automatically to type uuid HINT: Specify a USING expression to perform the conversion.
I already try to modify the type by hand doing:
CREATE EXTENSION "uuid-ossp";
ALTER TABLE baseuser ALTER COLUMN id SET DATA TYPE UUID USING (uuid_generate_v4());
end up with this error:
ERROR: default for column "Id" cannot be cast automatically to type uuid
I also tried sqlite without success
I just want to generate a new db with uuid, I don't care about existing data.