Changes between Initial Version and Version 1 of Ticket #30152


Ignore:
Timestamp:
Feb 1, 2019, 3:40:11 PM (5 years ago)
Author:
Carsten Fuchs
Comment:

I edited the console log in the description to make it more descriptive.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30152 – Description

    initial v1  
    6565(TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py --version
    66662.2a1
    67 (TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py migrate
     67(TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py migrate Lori 0021
    6868Operations to perform:
    69   Apply all migrations: Lori, admin, auth, contenttypes, sessions
     69  Target specific migration: 0021_alter_Vortraege_jahr, from Lori
    7070Running migrations:
    7171  Applying contenttypes.0001_initial… OK
     
    9292  Applying Lori.0020_del_PekoGewichte… OK
    9393  Applying Lori.0021_alter_Vortraege_jahr… OK
     94
     95(TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py sqlmigrate Lori 0022
     96BEGIN;
     97--
     98-- Alter field id on kostenstelle
     99--
     100ALTER TABLE `kostenstelle` DROP FOREIGN KEY `kostenstelle_parent_id_d0c73a18_fk_kostenstelle_id`;
     101ALTER TABLE `Lori_oeffnungszeiten` DROP FOREIGN KEY `Lori_oeffnungszeiten_kst_id_54e15381_fk_kostenstelle_id`;
     102ALTER TABLE `Lori_vertragsverlauf` DROP FOREIGN KEY `Lori_vertragsverlauf_kostenstelle_id_59f33815_fk_kostenstelle_id`;
     103ALTER TABLE `Lori_userkstzuordnung` DROP FOREIGN KEY `Lori_userkstzuordnun_kostenstelle_id_ac2cc3c0_fk_kostenste`;
     104ALTER TABLE `Lori_pekosollstd` DROP FOREIGN KEY `Lori_pekosollstd_kst_id_6b0156f7_fk_kostenstelle_id`;
     105ALTER TABLE `kostenstelle` MODIFY `id` integer NOT NULL;
     106ALTER TABLE `kostenstelle` MODIFY `parent_id` integer NULL;
     107ALTER TABLE `Lori_oeffnungszeiten` MODIFY `kst_id` integer NOT NULL;
     108ALTER TABLE `Lori_vertragsverlauf` MODIFY `kostenstelle_id` integer NULL;
     109ALTER TABLE `Lori_userkstzuordnung` MODIFY `kostenstelle_id` integer NOT NULL;
     110ALTER TABLE `Lori_pekosollstd` MODIFY `kst_id` integer NOT NULL;
     111ALTER TABLE `kostenstelle` ADD CONSTRAINT `kostenstelle_parent_id_d0c73a18_fk` FOREIGN KEY (`parent_id`) REFERENCES `kostenstelle` (`id`);
     112ALTER TABLE `Lori_oeffnungszeiten` ADD CONSTRAINT `Lori_oeffnungszeiten_kst_id_54e15381_fk` FOREIGN KEY (`kst_id`) REFERENCES `kostenstelle` (`id`);
     113ALTER TABLE `Lori_vertragsverlauf` ADD CONSTRAINT `Lori_vertragsverlauf_kostenstelle_id_59f33815_fk` FOREIGN KEY (`kostenstelle_id`) REFERENCES `kostenstelle` (`id`);
     114ALTER TABLE `Lori_userkstzuordnung` ADD CONSTRAINT `Lori_userkstzuordnung_kostenstelle_id_ac2cc3c0_fk` FOREIGN KEY (`kostenstelle_id`) REFERENCES `kostenstelle` (`id`);
     115ALTER TABLE `Lori_pekosollstd` ADD CONSTRAINT `Lori_pekosollstd_kst_id_6b0156f7_fk` FOREIGN KEY (`kst_id`) REFERENCES `kostenstelle` (`id`);
     116COMMIT;
     117
     118(TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py migrate Lori 0022
     119Operations to perform:
     120  Target specific migration: 0022_alter_Kostenstelle_id, from Lori
     121Running migrations:
    94122  Applying Lori.0022_alter_Kostenstelle_id…Traceback (most recent call last):
    95123  File "/home/carsten/.virtualenvs/TestDjango22a/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
     
    107135The above exception was the direct cause of the following exception:
    108136# ...
     137}}}
    109138
    110 (TestDjango22a) carsten@black-steel-ubuntu:~/Zeiterfassung$ ./manage.py sqlmigrate Lori 0022
    111 BEGIN;
    112 --
    113 -- Alter field id on kostenstelle
    114 --
    115 # I did not cut anything here: `manage.py sqlmigrate` seems to check which DROP FOREIGN KEY statements must still be emitted?
    116 # If I repeat `manage.py migrate` and `manage.py sqlmigrate`, the two lines with DROP FOREIGN KEY disappear as well.
    117 ALTER TABLE `Lori_userkstzuordnung` DROP FOREIGN KEY `Lori_userkstzuordnun_kostenstelle_id_ac2cc3c0_fk_kostenste`;
    118 ALTER TABLE `Lori_pekosollstd` DROP FOREIGN KEY `Lori_pekosollstd_kst_id_6b0156f7_fk_kostenstelle_id`;
    119 ALTER TABLE `kostenstelle` MODIFY `id` integer NOT NULL;
    120 ALTER TABLE `kostenstelle` MODIFY `parent_id` integer NULL;
    121 ALTER TABLE `Lori_oeffnungszeiten` MODIFY `kst_id` integer NOT NULL;
    122 ALTER TABLE `Lori_vertragsverlauf` MODIFY `kostenstelle_id` integer NULL;
    123 ALTER TABLE `Lori_userkstzuordnung` MODIFY `kostenstelle_id` integer NOT NULL;
    124 ALTER TABLE `Lori_pekosollstd` MODIFY `kst_id` integer NOT NULL;
    125 ALTER TABLE `kostenstelle` ADD CONSTRAINT `kostenstelle_parent_id_d0c73a18_fk` FOREIGN KEY (`parent_id`) REFERENCES `kostenstelle` (`id`);
    126 ALTER TABLE `Lori_oeffnungszeiten` ADD CONSTRAINT `Lori_oeffnungszeiten_kst_id_54e15381_fk` FOREIGN KEY (`kst_id`) REFERENCES `kostenstelle` (`id`);
    127 ALTER TABLE `Lori_vertragsverlauf` ADD CONSTRAINT `Lori_vertragsverlauf_kostenstelle_id_59f33815_fk` FOREIGN KEY (`kostenstelle_id`) REFERENCES `kostenstelle` (`id`);
    128 ALTER TABLE `Lori_userkstzuordnung` ADD CONSTRAINT `Lori_userkstzuordnung_kostenstelle_id_ac2cc3c0_fk` FOREIGN KEY (`kostenstelle_id`) REFERENCES `kostenstelle` (`id`);
    129 ALTER TABLE `Lori_pekosollstd` ADD CONSTRAINT `Lori_pekosollstd_kst_id_6b0156f7_fk` FOREIGN KEY (`kst_id`) REFERENCES `kostenstelle` (`id`);
    130 COMMIT;
    131 }}}
    132139I'm unsure how to proceed as I find it very difficult to come up with a testcase that can reproduce this.
Back to Top