Merge branch 'test' into data_migrations
This commit is contained in:
commit
5bac8fad75
4 changed files with 18 additions and 6 deletions
16
Makefile
16
Makefile
|
@ -119,12 +119,24 @@ sync_test_db:
|
||||||
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
||||||
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||||
pg_dump -Fc mam_prod > dump-prod.sql
|
pg_dump -Fc mam_prod > dump-prod.sql
|
||||||
pg_restore -c -d mam_test dump-prod.sql
|
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||||
|
rm dump-prod.sql
|
||||||
|
@echo Done.
|
||||||
|
|
||||||
|
# Aggresive variant: destroy original mam_test db with 'DROP OWNED BY "mam-web";'
|
||||||
|
sync_test_db_aggressive:
|
||||||
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
||||||
|
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||||
|
pg_dump -Fc mam_prod > dump-prod.sql
|
||||||
|
@# I am not sure which shell is used, so I am calling bash to make sure
|
||||||
|
bash -c "psql mam_test <<< 'DROP OWNED BY \"mam-web\";'"
|
||||||
|
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||||
rm dump-prod.sql
|
rm dump-prod.sql
|
||||||
@echo Done.
|
@echo Done.
|
||||||
|
|
||||||
# Sync test with production
|
# Sync test with production
|
||||||
sync_test: sync_test_media sync_test_db
|
# HACK ALERT: using aggressive variant, due to the schemas being too different.
|
||||||
|
sync_test: sync_test_media sync_test_db_aggressive
|
||||||
|
|
||||||
|
|
||||||
# Sync media directory with atrey. Useful for local development with production database
|
# Sync media directory with atrey. Useful for local development with production database
|
||||||
|
|
|
@ -1518,7 +1518,7 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
('body', models.DecimalField(decimal_places=1, max_digits=8, verbose_name='body')),
|
('body', models.DecimalField(decimal_places=1, max_digits=8, verbose_name='body')),
|
||||||
('cislo_body', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body')),
|
('cislo_body', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body', null=True)),
|
||||||
('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Problem', verbose_name='problém')),
|
('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Problem', verbose_name='problém')),
|
||||||
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení')),
|
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení')),
|
||||||
],
|
],
|
||||||
|
@ -2025,7 +2025,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
name='cislo_body',
|
name='cislo_body',
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'),
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body', null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
|
|
|
@ -453,7 +453,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
name='cislo_body',
|
name='cislo_body',
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'),
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body', null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
name='cislo_body',
|
name='cislo_body',
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'),
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body', null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='hodnoceni',
|
model_name='hodnoceni',
|
||||||
|
|
Loading…
Reference in a new issue