Skip to content

Commit

Permalink
fix: on_delete constraints in model and migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Sep 29, 2023
1 parent e18ab80 commit 2250ced
Show file tree
Hide file tree
Showing 24 changed files with 134 additions and 134 deletions.
18 changes: 9 additions & 9 deletions ricerca_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Migration(migrations.Migration):
('dt_mod', models.DateTimeField(auto_now=True, db_column='DT_MOD', null=True)),
('cod_erc1', models.CharField(db_column='COD_ERC1', max_length=40, unique=True)),
('descrizione', models.TextField(db_column='DESCRIZIONE')),
('ricerca_erc0_cod', models.ForeignKey(blank=True, db_column='RICERCA_ERC0_COD', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaerc0')),
('ricerca_erc0_cod', models.ForeignKey(blank=True, db_column='RICERCA_ERC0_COD', null=True, on_delete=django.db.models.deletion.PROTECT, to='ricerca_app.ricercaerc0')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_re1', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_re1', to=settings.AUTH_USER_MODEL)),
],
Expand All @@ -409,7 +409,7 @@ class Migration(migrations.Migration):
('dt_mod', models.DateTimeField(auto_now=True, db_column='DT_MOD', null=True)),
('cod_erc2', models.CharField(db_column='COD_ERC2', max_length=60, unique=True)),
('descrizione', models.TextField(db_column='DESCRIZIONE')),
('ricerca_erc1', models.ForeignKey(blank=True, db_column='RICERCA_ERC1_ID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaerc1')),
('ricerca_erc1', models.ForeignKey(blank=True, db_column='RICERCA_ERC1_ID', null=True, on_delete=django.db.models.deletion.PROTECT, to='ricerca_app.ricercaerc1')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_re2', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_re2', to=settings.AUTH_USER_MODEL)),
],
Expand Down Expand Up @@ -464,7 +464,7 @@ class Migration(migrations.Migration):
('descrizione', models.CharField(db_column='DESCRIZIONE', max_length=400)),
('descr_pubblicaz_prog_brevetto', models.TextField(blank=True, db_column='DESCR_PUBBLICAZ_PROG_BREVETTO', null=True)),
('anno', models.IntegerField(blank=True, db_column='ANNO', null=True)),
('ricerca_erc2', models.ForeignKey(db_column='RICERCA_ERC2_ID', on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaerc2')),
('ricerca_erc2', models.ForeignKey(db_column='RICERCA_ERC2_ID', on_delete=django.db.models.deletion.SET_NULL, to='ricerca_app.ricercaerc2')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_rlb', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_rlb', to=settings.AUTH_USER_MODEL)),
],
Expand All @@ -482,7 +482,7 @@ class Migration(migrations.Migration):
('descrizione', models.CharField(db_column='DESCRIZIONE', max_length=400)),
('descr_pubblicaz_prog_brevetto', models.TextField(blank=True, db_column='DESCR_PUBBLICAZ_PROG_BREVETTO', null=True)),
('anno', models.IntegerField(blank=True, db_column='ANNO', null=True)),
('ricerca_aster2', models.ForeignKey(db_column='RICERCA_ASTER2_ID', on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaaster2')),
('ricerca_aster2', models.ForeignKey(db_column='RICERCA_ASTER2_ID', on_delete=django.db.models.deletion.SET_NULL, to='ricerca_app.ricercaaster2')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_rla', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_rla', to=settings.AUTH_USER_MODEL)),
],
Expand Down Expand Up @@ -515,8 +515,8 @@ class Migration(migrations.Migration):
('dt_mod', models.DateTimeField(auto_now=True, db_column='DT_MOD', null=True)),
('dt_inizio', models.DateField(blank=True, db_column='DT_INIZIO', null=True)),
('dt_fine', models.DateField(blank=True, db_column='DT_FINE', null=True)),
('personale', models.ForeignKey(blank=True, db_column='PERSONALE_ID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.personale')),
('ricerca_linea_base', models.ForeignKey(blank=True, db_column='RICERCA_LINEA_BASE_ID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercalineabase')),
('personale', models.ForeignKey(blank=True, db_column='PERSONALE_ID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.personale')),
('ricerca_linea_base', models.ForeignKey(blank=True, db_column='RICERCA_LINEA_BASE_ID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.ricercalineabase')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_rdlb', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_rdlb', to=settings.AUTH_USER_MODEL)),
],
Expand All @@ -533,8 +533,8 @@ class Migration(migrations.Migration):
('dt_mod', models.DateTimeField(blank=True, db_column='DT_MOD', null=True)),
('dt_inizio', models.DateField(blank=True, db_column='DT_INIZIO', null=True)),
('dt_fine', models.DateField(blank=True, db_column='DT_FINE', null=True)),
('personale', models.ForeignKey(blank=True, db_column='PERSONALE_ID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.personale')),
('ricerca_linea_applicata', models.ForeignKey(blank=True, db_column='RICERCA_LINEA_APPLICATA_ID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercalineaapplicata')),
('personale', models.ForeignKey(blank=True, db_column='PERSONALE_ID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.personale')),
('ricerca_linea_applicata', models.ForeignKey(blank=True, db_column='RICERCA_LINEA_APPLICATA_ID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.ricercalineaapplicata')),
('user_ins', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_ins_rdla', to=settings.AUTH_USER_MODEL)),
('user_mod', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_mod_rdla', to=settings.AUTH_USER_MODEL)),
],
Expand Down Expand Up @@ -564,7 +564,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='ricercaaster1',
name='ricerca_erc0_cod',
field=models.ForeignKey(blank=True, db_column='RICERCA_ERC0_COD', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaerc0'),
field=models.ForeignKey(blank=True, db_column='RICERCA_ERC0_COD', null=True, on_delete=django.db.models.deletion.PROTECT, to='ricerca_app.ricercaerc0'),
),
migrations.AddField(
model_name='ricercaaster1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Migration(migrations.Migration):
('piano', models.CharField(blank=True, db_column='PIANO', max_length=100, null=True)),
('sede_principale', models.CharField(blank=True, db_column='SEDE_PRINCIPALE', max_length=10, null=True)),
('note', models.TextField(blank=True, db_column='NOTE', null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_UBICAZIONE',
Expand All @@ -71,7 +71,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(db_column='ID', primary_key=True, serialize=False)),
('nome_servizio', models.TextField(blank=True, db_column='NOME_SERVIZIO', null=True)),
('descrizione_servizio', models.TextField(blank=True, db_column='DESCRIZIONE_SERVIZIO', null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_SERVIZI_OFFERTI',
Expand All @@ -90,7 +90,7 @@ class Migration(migrations.Migration):
('durata_mesi', models.IntegerField(blank=True, null=True)),
('importo_euro', models.FloatField(blank=True, null=True)),
('strumentazione', models.TextField(blank=True, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_SERVIZI_EROGATI',
Expand All @@ -105,7 +105,7 @@ class Migration(migrations.Migration):
('ruolo', models.CharField(blank=True, db_column='RUOLO', max_length=400, null=True)),
('field_impegno', models.FloatField(blank=True, db_column='%IMPEGNO', null=True)),
('cognomenome_origine', models.CharField(blank=True, db_column='COGNOMENOME_ORIGINE', max_length=200, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_PERSONALE_TECNICO',
Expand All @@ -118,7 +118,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(db_column='ID', primary_key=True, serialize=False)),
('matricola_personale_ricerca', models.CharField(blank=True, db_column='MATRICOLA_PERSONALE_RICERCA', max_length=20, null=True)),
('cognomenome_origine', models.CharField(blank=True, db_column='COGNOMENOME_ORIGINE', max_length=200, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_PERSONALE_RICERCA',
Expand All @@ -129,8 +129,8 @@ class Migration(migrations.Migration):
name='LaboratorioDatiErc1',
fields=[
('id', models.AutoField(db_column='ID', primary_key=True, serialize=False)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_ricerca_erc1', models.ForeignKey(blank=True, db_column='ID_RICERCA_ERC1', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercaerc1')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
('id_ricerca_erc1', models.ForeignKey(blank=True, db_column='ID_RICERCA_ERC1', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.ricercaerc1')),
],
options={
'db_table': 'LABORATORIO_DATI_ERC1',
Expand All @@ -147,7 +147,7 @@ class Migration(migrations.Migration):
('costo_unitario', models.FloatField(blank=True, null=True)),
('quantita', models.IntegerField(blank=True, null=True)),
('tipo_rischi', models.CharField(blank=True, max_length=500, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_ATTREZZATURE',
Expand All @@ -159,7 +159,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(db_column='ID', primary_key=True, serialize=False)),
('tipologia_attivita', models.CharField(blank=True, db_column='TIPOLOGIA_ATTIVITA', max_length=200, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.ricercadocentelineabase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.ricercadocentelineabase')),
],
options={
'db_table': 'LABORATORIO_ATTIVITA',
Expand Down
10 changes: 5 additions & 5 deletions ricerca_app/migrations/0010_auto_20210720_0446.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='laboratorioattivita',
name='id_laboratorio_dati',
field=models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase'),
field=models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase'),
),
migrations.AlterField(
model_name='laboratorioattrezzature',
Expand Down Expand Up @@ -54,17 +54,17 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='laboratoriodatibase',
name='matricola_preposto_sicurezza',
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PREPOSTO_SICUREZZA', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='matricola_preposto_sicurezza_personale', to='ricerca_app.personale'),
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PREPOSTO_SICUREZZA', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='matricola_preposto_sicurezza_personale', to='ricerca_app.personale'),
),
migrations.AlterField(
model_name='laboratoriodatibase',
name='matricola_referente_compilazione',
field=models.ForeignKey(blank=True, db_column='MATRICOLA_REFERENTE_COMPILAZIONE', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='matricola_referente_compilazione_personale', to='ricerca_app.personale'),
field=models.ForeignKey(blank=True, db_column='MATRICOLA_REFERENTE_COMPILAZIONE', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='matricola_referente_compilazione_personale', to='ricerca_app.personale'),
),
migrations.AlterField(
model_name='laboratoriodatibase',
name='matricola_responsabile_scientifico',
field=models.ForeignKey(blank=True, db_column='MATRICOLA_RESPONSABILE_SCIENTIFICO', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='matricola_responsabile_scientifico_personale', to='ricerca_app.personale'),
field=models.ForeignKey(blank=True, db_column='MATRICOLA_RESPONSABILE_SCIENTIFICO', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='matricola_responsabile_scientifico_personale', to='ricerca_app.personale'),
),
migrations.AlterField(
model_name='laboratorioservizierogati',
Expand Down Expand Up @@ -111,7 +111,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(db_column='ID', primary_key=True, serialize=False)),
('tipologia_rischio', models.CharField(blank=True, db_column='TIPOLOGIA_RISCHIO', max_length=500, null=True)),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.laboratoriodatibase')),
('id_laboratorio_dati', models.ForeignKey(blank=True, db_column='ID_LABORATORIO_DATI', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.laboratoriodatibase')),
],
options={
'db_table': 'LABORATORIO_TIPOLOGIA_RISCHIO',
Expand Down
4 changes: 2 additions & 2 deletions ricerca_app/migrations/0011_auto_20210720_0557.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='laboratoriopersonalericerca',
name='matricola_personale_ricerca',
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PERSONALE_RICERCA', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.personale'),
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PERSONALE_RICERCA', null=True, on_delete=django.db.models.deletion.SET_NULL, to='ricerca_app.personale'),
),
migrations.AlterField(
model_name='laboratoriopersonaletecnico',
name='matricola_personale_tecnico',
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PERSONALE_TECNICO', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='ricerca_app.personale'),
field=models.ForeignKey(blank=True, db_column='MATRICOLA_PERSONALE_TECNICO', null=True, on_delete=django.db.models.deletion.CASCADE, to='ricerca_app.personale'),
),
]
Loading

0 comments on commit 2250ced

Please sign in to comment.