Skip to content

Commit

Permalink
added seed data
Browse files Browse the repository at this point in the history
  • Loading branch information
del9ra authored and fyliu committed Sep 20, 2024
1 parent 14df6e9 commit e58103b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
53 changes: 53 additions & 0 deletions app/core/initial_data/SocMajor_export.json
Original file line number Diff line number Diff line change
@@ -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"
}

]
30 changes: 30 additions & 0 deletions app/data/migrations/0006_socmajor_seed.py
Original file line number Diff line number Diff line change
@@ -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)]
2 changes: 1 addition & 1 deletion app/data/migrations/max_migration.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0005_checktype_seed
0006_socmajor_seed

0 comments on commit e58103b

Please sign in to comment.