From e58103bfcffa34ea5c03305c63c9ea97767b03a7 Mon Sep 17 00:00:00 2001 From: del9ra Date: Tue, 17 Sep 2024 14:57:12 -0400 Subject: [PATCH] added seed data --- app/core/initial_data/SocMajor_export.json | 53 ++++++++++++++++++++++ app/data/migrations/0006_socmajor_seed.py | 30 ++++++++++++ app/data/migrations/max_migration.txt | 2 +- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 app/core/initial_data/SocMajor_export.json create mode 100644 app/data/migrations/0006_socmajor_seed.py diff --git a/app/core/initial_data/SocMajor_export.json b/app/core/initial_data/SocMajor_export.json new file mode 100644 index 00000000..2b9a0346 --- /dev/null +++ b/app/core/initial_data/SocMajor_export.json @@ -0,0 +1,53 @@ +[ + { + "uuid": 1, + "occ_code": "11-2000", + "title": "Management Occupations" + }, + { + "uuid": 2, + "occ_code": "13-0000", + "title": "Business and Financial Operations Occupations" + }, + { + "uuid": 3, + "occ_code": "15-0000", + "title": "Computer and Mathematical Occupations" + }, + { + "uuid": 4, + "occ_code": "17-0000", + "title": "Architecture and Engineering Occupations" + }, + { + "uuid": 5, + "occ_code": "19-0000", + "title": "Life, Physical, and Social Science Occupations" + }, + { + "uuid": 6, + "occ_code": "21-0000", + "title": "Community and Social Service Occupations" + }, + { + "uuid": 7, + "occ_code": "23-0000", + "title": "Legal Occupations" + }, + { + "uuid": 8, + "occ_code": "25-0000", + "title": "Educational Instruction and Library Occupations" + }, + { + "uuid": 9, + "occ_code": "27-0000", + "title": "Arts, Design, Entertainment, Sports, and Media Occupations" + }, + { + "uuid": 10, + "occ_code": "29-0000", + "title": "Healthcare Practitioners and Technical Occupations" + } + +] diff --git a/app/data/migrations/0006_socmajor_seed.py b/app/data/migrations/0006_socmajor_seed.py new file mode 100644 index 00000000..cfa3e214 --- /dev/null +++ b/app/data/migrations/0006_socmajor_seed.py @@ -0,0 +1,30 @@ +from django.db import migrations + +from core.models import SocMajor + + +def forward(__code__, __reverse_code__): + items = [ + (1, "11-2000", "Management Occupations"), + (2, "13-0000", "Business and Financial Operations Occupations"), + (3, "15-0000", "Computer and Mathematical Occupations"), + (4, "17-0000", "Architecture and Engineering Occupations"), + (5, "19-0000", "Life, Physical, and Social Science Occupations"), + (6, "21-0000", "Community and Social Service Occupations"), + (7, "23-0000", "Legal Occupations"), + (8, "25-0000", "Educational Instruction and Library Occupations"), + (9, "27-0000", "Arts, Design, Entertainment, Sports, and Media Occupations"), + (10, "29-0000", "Healthcare Practitioners and Technical Occupations"), + ] + for uuid, occ_code, title in items: + SocMajor.objects.create(uuid=uuid, occ_code=occ_code, title=title) + + +def reverse(__code__, __reverse_code__): + SocMajor.objects.all().delete() + + +class Migration(migrations.Migration): + dependencies = [("data", "0005_checktype_seed")] + + operations = [migrations.RunPython(forward, reverse)] diff --git a/app/data/migrations/max_migration.txt b/app/data/migrations/max_migration.txt index 9828f447..27224cbb 100644 --- a/app/data/migrations/max_migration.txt +++ b/app/data/migrations/max_migration.txt @@ -1 +1 @@ -0005_checktype_seed +0006_socmajor_seed