Mam aplikację django/postgresql. Ilekroć uruchomić moją ostatnią migrację, pojawia się następujący błąd:Migracja Django nie powodzi
ValueError: Found wrong number (0) of constraints for package(speciality, title)
wierzę muszę dostosować migrację, ale co mam zrobić zmiany.
To jest migracja:
operations = [
migrations.AddField( model_name='package', name='speciality', field=models.ManyToManyField(related_name='specialities', to='speciality.Speciality', blank=True), ), migrations.AlterField( model_name='package', name='title', field=models.CharField(unique=True, max_length=50), ), migrations.AlterUniqueTogether( name='package', unique_together=set([]), ), migrations.RemoveField( model_name='package', name='speciality', ), ]
To jest mój obecny stół dotyczących konfiguracji dla tego modelu:
sleepyfish=# \d package Table "public.package" Column | Type | Modifiers
---------------+--------------------------+------------------------------------------------------ id | integer | not null default nextval('package_id_seq'::regclass) created_at | timestamp with time zone | not null updated_at | timestamp with time zone | not null title | character varying(50) | not null description | text | status | boolean
| not null price | numeric(8,2) | not null speciality_id | integer | Indexes: "package_pkey" PRIMARY KEY, btree (id) "package_speciality_id_3aeb5c97679442e4_uniq" UNIQUE CONSTRAINT, btree (speciality_id, title) "package_66db61fe" btree (speciality_id) Foreign-key constraints: "package_speciality_id_4255b58fe1ae00c0_fk_speciality_id" FOREIGN KEY (speciality_id) REFERENCES speciality(id) DEFERRABLE INITIALLY DEFERRED Referenced by: TABLE "claimedpackage" CONSTRAINT "claimedpackage_package_id_9e1da358fbb9a46_fk_package_id" FOREIGN KEY (package_id) REFERENCES package(id) DEFERRABLE INITIALLY DEFERRED TABLE "package_service" CONSTRAINT "package_service_package_id_3b0ea08bfcd8da76_fk_package_id" FOREIGN KEY (package_id) REFERENCES package(id) DEFERRABLE INITIALLY DEFERRED
Czy domyślnie zdefiniowano jakąś wartość specjalną? – Marlysson
Czy możesz pokazać kod swojego 'models.py'? – williezh