From dd673a2f58a9ec820963cde82003c82e73edc8ce Mon Sep 17 00:00:00 2001
From: CocoByte
Date: Wed, 29 Nov 2023 16:01:58 -0700
Subject: [PATCH 01/22] Fed agency and state are now dropdowns
---
...mainapplication_federal_agency_and_more.py | 771 ++++++++++++++++++
src/registrar/models/domain_application.py | 2 +
src/registrar/models/domain_information.py | 2 +
3 files changed, 775 insertions(+)
create mode 100644 src/registrar/migrations/0048_alter_domainapplication_federal_agency_and_more.py
diff --git a/src/registrar/migrations/0048_alter_domainapplication_federal_agency_and_more.py b/src/registrar/migrations/0048_alter_domainapplication_federal_agency_and_more.py
new file mode 100644
index 000000000..e00d67cb5
--- /dev/null
+++ b/src/registrar/migrations/0048_alter_domainapplication_federal_agency_and_more.py
@@ -0,0 +1,771 @@
+# Generated by Django 4.2.7 on 2023-11-29 22:32
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("registrar", "0047_transitiondomain_address_line_transitiondomain_city_and_more"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="domainapplication",
+ name="federal_agency",
+ field=models.TextField(
+ blank=True,
+ choices=[
+ (
+ "Administrative Conference of the United States",
+ "Administrative Conference of the United States",
+ ),
+ ("Advisory Council on Historic Preservation", "Advisory Council on Historic Preservation"),
+ ("American Battle Monuments Commission", "American Battle Monuments Commission"),
+ ("AMTRAK", "AMTRAK"),
+ ("Appalachian Regional Commission", "Appalachian Regional Commission"),
+ (
+ "Appraisal Subcommittee of the Federal Financial Institutions Examination Council",
+ "Appraisal Subcommittee of the Federal Financial Institutions Examination Council",
+ ),
+ ("Appraisal Subcommittee", "Appraisal Subcommittee"),
+ ("Architect of the Capitol", "Architect of the Capitol"),
+ ("Armed Forces Retirement Home", "Armed Forces Retirement Home"),
+ (
+ "Barry Goldwater Scholarship and Excellence in Education Foundation",
+ "Barry Goldwater Scholarship and Excellence in Education Foundation",
+ ),
+ (
+ "Barry Goldwater Scholarship and Excellence in Education Program",
+ "Barry Goldwater Scholarship and Excellence in Education Program",
+ ),
+ ("Central Intelligence Agency", "Central Intelligence Agency"),
+ ("Chemical Safety Board", "Chemical Safety Board"),
+ ("Christopher Columbus Fellowship Foundation", "Christopher Columbus Fellowship Foundation"),
+ ("Civil Rights Cold Case Records Review Board", "Civil Rights Cold Case Records Review Board"),
+ (
+ "Commission for the Preservation of America's Heritage Abroad",
+ "Commission for the Preservation of America's Heritage Abroad",
+ ),
+ ("Commission of Fine Arts", "Commission of Fine Arts"),
+ (
+ "Committee for Purchase From People Who Are Blind or Severely Disabled",
+ "Committee for Purchase From People Who Are Blind or Severely Disabled",
+ ),
+ ("Commodity Futures Trading Commission", "Commodity Futures Trading Commission"),
+ ("Congressional Budget Office", "Congressional Budget Office"),
+ ("Consumer Financial Protection Bureau", "Consumer Financial Protection Bureau"),
+ ("Consumer Product Safety Commission", "Consumer Product Safety Commission"),
+ ("Corporation for National & Community Service", "Corporation for National & Community Service"),
+ (
+ "Corporation for National and Community Service",
+ "Corporation for National and Community Service",
+ ),
+ (
+ "Council of Inspectors General on Integrity and Efficiency",
+ "Council of Inspectors General on Integrity and Efficiency",
+ ),
+ ("Court Services and Offender Supervision", "Court Services and Offender Supervision"),
+ ("Cyberspace Solarium Commission", "Cyberspace Solarium Commission"),
+ (
+ "DC Court Services and Offender Supervision Agency",
+ "DC Court Services and Offender Supervision Agency",
+ ),
+ ("DC Pre-trial Services", "DC Pre-trial Services"),
+ ("Defense Nuclear Facilities Safety Board", "Defense Nuclear Facilities Safety Board"),
+ ("Delta Regional Authority", "Delta Regional Authority"),
+ ("Denali Commission", "Denali Commission"),
+ ("Department of Agriculture", "Department of Agriculture"),
+ ("Department of Commerce", "Department of Commerce"),
+ ("Department of Defense", "Department of Defense"),
+ ("Department of Education", "Department of Education"),
+ ("Department of Energy", "Department of Energy"),
+ ("Department of Health and Human Services", "Department of Health and Human Services"),
+ ("Department of Homeland Security", "Department of Homeland Security"),
+ ("Department of Housing and Urban Development", "Department of Housing and Urban Development"),
+ ("Department of Justice", "Department of Justice"),
+ ("Department of Labor", "Department of Labor"),
+ ("Department of State", "Department of State"),
+ ("Department of the Interior", "Department of the Interior"),
+ ("Department of the Treasury", "Department of the Treasury"),
+ ("Department of Transportation", "Department of Transportation"),
+ ("Department of Veterans Affairs", "Department of Veterans Affairs"),
+ ("Director of National Intelligence", "Director of National Intelligence"),
+ ("Dwight D. Eisenhower Memorial Commission", "Dwight D. Eisenhower Memorial Commission"),
+ ("Election Assistance Commission", "Election Assistance Commission"),
+ ("Environmental Protection Agency", "Environmental Protection Agency"),
+ ("Equal Employment Opportunity Commission", "Equal Employment Opportunity Commission"),
+ ("Executive Office of the President", "Executive Office of the President"),
+ ("Export-Import Bank of the United States", "Export-Import Bank of the United States"),
+ ("Export/Import Bank of the U.S.", "Export/Import Bank of the U.S."),
+ ("Farm Credit Administration", "Farm Credit Administration"),
+ ("Farm Credit System Insurance Corporation", "Farm Credit System Insurance Corporation"),
+ ("Federal Communications Commission", "Federal Communications Commission"),
+ ("Federal Deposit Insurance Corporation", "Federal Deposit Insurance Corporation"),
+ ("Federal Election Commission", "Federal Election Commission"),
+ ("Federal Energy Regulatory Commission", "Federal Energy Regulatory Commission"),
+ (
+ "Federal Financial Institutions Examination Council",
+ "Federal Financial Institutions Examination Council",
+ ),
+ ("Federal Housing Finance Agency", "Federal Housing Finance Agency"),
+ ("Federal Judiciary", "Federal Judiciary"),
+ ("Federal Labor Relations Authority", "Federal Labor Relations Authority"),
+ ("Federal Maritime Commission", "Federal Maritime Commission"),
+ ("Federal Mediation and Conciliation Service", "Federal Mediation and Conciliation Service"),
+ (
+ "Federal Mine Safety and Health Review Commission",
+ "Federal Mine Safety and Health Review Commission",
+ ),
+ (
+ "Federal Permitting Improvement Steering Council",
+ "Federal Permitting Improvement Steering Council",
+ ),
+ ("Federal Reserve Board of Governors", "Federal Reserve Board of Governors"),
+ ("Federal Reserve System", "Federal Reserve System"),
+ ("Federal Trade Commission", "Federal Trade Commission"),
+ ("General Services Administration", "General Services Administration"),
+ ("gov Administration", "gov Administration"),
+ ("Government Accountability Office", "Government Accountability Office"),
+ ("Government Publishing Office", "Government Publishing Office"),
+ ("Gulf Coast Ecosystem Restoration Council", "Gulf Coast Ecosystem Restoration Council"),
+ ("Harry S Truman Scholarship Foundation", "Harry S Truman Scholarship Foundation"),
+ ("Harry S. Truman Scholarship Foundation", "Harry S. Truman Scholarship Foundation"),
+ ("Institute of Museum and Library Services", "Institute of Museum and Library Services"),
+ ("Institute of Peace", "Institute of Peace"),
+ ("Inter-American Foundation", "Inter-American Foundation"),
+ (
+ "International Boundary and Water Commission: United States and Mexico",
+ "International Boundary and Water Commission: United States and Mexico",
+ ),
+ (
+ "International Boundary Commission: United States and Canada",
+ "International Boundary Commission: United States and Canada",
+ ),
+ (
+ "International Joint Commission: United States and Canada",
+ "International Joint Commission: United States and Canada",
+ ),
+ ("James Madison Memorial Fellowship Foundation", "James Madison Memorial Fellowship Foundation"),
+ ("Japan-United States Friendship Commission", "Japan-United States Friendship Commission"),
+ ("Japan-US Friendship Commission", "Japan-US Friendship Commission"),
+ ("John F. Kennedy Center for Performing Arts", "John F. Kennedy Center for Performing Arts"),
+ (
+ "John F. Kennedy Center for the Performing Arts",
+ "John F. Kennedy Center for the Performing Arts",
+ ),
+ ("Legal Services Corporation", "Legal Services Corporation"),
+ ("Legislative Branch", "Legislative Branch"),
+ ("Library of Congress", "Library of Congress"),
+ ("Marine Mammal Commission", "Marine Mammal Commission"),
+ (
+ "Medicaid and CHIP Payment and Access Commission",
+ "Medicaid and CHIP Payment and Access Commission",
+ ),
+ ("Medical Payment Advisory Commission", "Medical Payment Advisory Commission"),
+ ("Medicare Payment Advisory Commission", "Medicare Payment Advisory Commission"),
+ ("Merit Systems Protection Board", "Merit Systems Protection Board"),
+ ("Millennium Challenge Corporation", "Millennium Challenge Corporation"),
+ (
+ "Morris K. Udall and Stewart L. Udall Foundation",
+ "Morris K. Udall and Stewart L. Udall Foundation",
+ ),
+ ("National Aeronautics and Space Administration", "National Aeronautics and Space Administration"),
+ ("National Archives and Records Administration", "National Archives and Records Administration"),
+ ("National Capital Planning Commission", "National Capital Planning Commission"),
+ ("National Council on Disability", "National Council on Disability"),
+ ("National Credit Union Administration", "National Credit Union Administration"),
+ ("National Endowment for the Arts", "National Endowment for the Arts"),
+ ("National Endowment for the Humanities", "National Endowment for the Humanities"),
+ (
+ "National Foundation on the Arts and the Humanities",
+ "National Foundation on the Arts and the Humanities",
+ ),
+ ("National Gallery of Art", "National Gallery of Art"),
+ ("National Indian Gaming Commission", "National Indian Gaming Commission"),
+ ("National Labor Relations Board", "National Labor Relations Board"),
+ ("National Mediation Board", "National Mediation Board"),
+ ("National Science Foundation", "National Science Foundation"),
+ (
+ "National Security Commission on Artificial Intelligence",
+ "National Security Commission on Artificial Intelligence",
+ ),
+ ("National Transportation Safety Board", "National Transportation Safety Board"),
+ (
+ "Networking Information Technology Research and Development",
+ "Networking Information Technology Research and Development",
+ ),
+ ("Non-Federal Agency", "Non-Federal Agency"),
+ ("Northern Border Regional Commission", "Northern Border Regional Commission"),
+ ("Nuclear Regulatory Commission", "Nuclear Regulatory Commission"),
+ ("Nuclear Safety Oversight Committee", "Nuclear Safety Oversight Committee"),
+ ("Nuclear Waste Technical Review Board", "Nuclear Waste Technical Review Board"),
+ (
+ "Occupational Safety & Health Review Commission",
+ "Occupational Safety & Health Review Commission",
+ ),
+ (
+ "Occupational Safety and Health Review Commission",
+ "Occupational Safety and Health Review Commission",
+ ),
+ ("Office of Compliance", "Office of Compliance"),
+ ("Office of Congressional Workplace Rights", "Office of Congressional Workplace Rights"),
+ ("Office of Government Ethics", "Office of Government Ethics"),
+ ("Office of Navajo and Hopi Indian Relocation", "Office of Navajo and Hopi Indian Relocation"),
+ ("Office of Personnel Management", "Office of Personnel Management"),
+ ("Open World Leadership Center", "Open World Leadership Center"),
+ ("Overseas Private Investment Corporation", "Overseas Private Investment Corporation"),
+ ("Peace Corps", "Peace Corps"),
+ ("Pension Benefit Guaranty Corporation", "Pension Benefit Guaranty Corporation"),
+ ("Postal Regulatory Commission", "Postal Regulatory Commission"),
+ ("Presidio Trust", "Presidio Trust"),
+ ("Privacy and Civil Liberties Oversight Board", "Privacy and Civil Liberties Oversight Board"),
+ ("Public Buildings Reform Board", "Public Buildings Reform Board"),
+ (
+ "Public Defender Service for the District of Columbia",
+ "Public Defender Service for the District of Columbia",
+ ),
+ ("Railroad Retirement Board", "Railroad Retirement Board"),
+ ("Securities and Exchange Commission", "Securities and Exchange Commission"),
+ ("Selective Service System", "Selective Service System"),
+ ("Small Business Administration", "Small Business Administration"),
+ ("Smithsonian Institution", "Smithsonian Institution"),
+ ("Social Security Administration", "Social Security Administration"),
+ ("Social Security Advisory Board", "Social Security Advisory Board"),
+ ("Southeast Crescent Regional Commission", "Southeast Crescent Regional Commission"),
+ ("Southwest Border Regional Commission", "Southwest Border Regional Commission"),
+ ("State Justice Institute", "State Justice Institute"),
+ ("State, Local, and Tribal Government", "State, Local, and Tribal Government"),
+ ("Stennis Center for Public Service", "Stennis Center for Public Service"),
+ ("Surface Transportation Board", "Surface Transportation Board"),
+ ("Tennessee Valley Authority", "Tennessee Valley Authority"),
+ ("The Executive Office of the President", "The Executive Office of the President"),
+ ("The Intelligence Community", "The Intelligence Community"),
+ ("The Legislative Branch", "The Legislative Branch"),
+ ("The Supreme Court", "The Supreme Court"),
+ (
+ "The United States World War One Centennial Commission",
+ "The United States World War One Centennial Commission",
+ ),
+ ("U.S. Access Board", "U.S. Access Board"),
+ ("U.S. Agency for Global Media", "U.S. Agency for Global Media"),
+ ("U.S. Agency for International Development", "U.S. Agency for International Development"),
+ ("U.S. Capitol Police", "U.S. Capitol Police"),
+ ("U.S. Chemical Safety Board", "U.S. Chemical Safety Board"),
+ (
+ "U.S. China Economic and Security Review Commission",
+ "U.S. China Economic and Security Review Commission",
+ ),
+ (
+ "U.S. Commission for the Preservation of Americas Heritage Abroad",
+ "U.S. Commission for the Preservation of Americas Heritage Abroad",
+ ),
+ ("U.S. Commission of Fine Arts", "U.S. Commission of Fine Arts"),
+ ("U.S. Commission on Civil Rights", "U.S. Commission on Civil Rights"),
+ (
+ "U.S. Commission on International Religious Freedom",
+ "U.S. Commission on International Religious Freedom",
+ ),
+ ("U.S. Courts", "U.S. Courts"),
+ ("U.S. Department of Agriculture", "U.S. Department of Agriculture"),
+ ("U.S. Interagency Council on Homelessness", "U.S. Interagency Council on Homelessness"),
+ ("U.S. International Trade Commission", "U.S. International Trade Commission"),
+ ("U.S. Nuclear Waste Technical Review Board", "U.S. Nuclear Waste Technical Review Board"),
+ ("U.S. Office of Special Counsel", "U.S. Office of Special Counsel"),
+ ("U.S. Peace Corps", "U.S. Peace Corps"),
+ ("U.S. Postal Service", "U.S. Postal Service"),
+ ("U.S. Semiquincentennial Commission", "U.S. Semiquincentennial Commission"),
+ ("U.S. Trade and Development Agency", "U.S. Trade and Development Agency"),
+ (
+ "U.S.-China Economic and Security Review Commission",
+ "U.S.-China Economic and Security Review Commission",
+ ),
+ ("Udall Foundation", "Udall Foundation"),
+ ("United States AbilityOne", "United States AbilityOne"),
+ ("United States Access Board", "United States Access Board"),
+ ("United States African Development Foundation", "United States African Development Foundation"),
+ ("United States Agency for Global Media", "United States Agency for Global Media"),
+ ("United States Arctic Research Commission", "United States Arctic Research Commission"),
+ ("United States Global Change Research Program", "United States Global Change Research Program"),
+ ("United States Holocaust Memorial Museum", "United States Holocaust Memorial Museum"),
+ ("United States Institute of Peace", "United States Institute of Peace"),
+ (
+ "United States Interagency Council on Homelessness",
+ "United States Interagency Council on Homelessness",
+ ),
+ (
+ "United States International Development Finance Corporation",
+ "United States International Development Finance Corporation",
+ ),
+ ("United States International Trade Commission", "United States International Trade Commission"),
+ ("United States Postal Service", "United States Postal Service"),
+ ("United States Senate", "United States Senate"),
+ ("United States Trade and Development Agency", "United States Trade and Development Agency"),
+ (
+ "Utah Reclamation Mitigation and Conservation Commission",
+ "Utah Reclamation Mitigation and Conservation Commission",
+ ),
+ ("Vietnam Education Foundation", "Vietnam Education Foundation"),
+ ("Western Hemisphere Drug Policy Commission", "Western Hemisphere Drug Policy Commission"),
+ (
+ "Woodrow Wilson International Center for Scholars",
+ "Woodrow Wilson International Center for Scholars",
+ ),
+ ("World War I Centennial Commission", "World War I Centennial Commission"),
+ ],
+ help_text="Federal agency",
+ null=True,
+ ),
+ ),
+ migrations.AlterField(
+ model_name="domainapplication",
+ name="state_territory",
+ field=models.CharField(
+ blank=True,
+ choices=[
+ ("AL", "Alabama (AL)"),
+ ("AK", "Alaska (AK)"),
+ ("AS", "American Samoa (AS)"),
+ ("AZ", "Arizona (AZ)"),
+ ("AR", "Arkansas (AR)"),
+ ("CA", "California (CA)"),
+ ("CO", "Colorado (CO)"),
+ ("CT", "Connecticut (CT)"),
+ ("DE", "Delaware (DE)"),
+ ("DC", "District of Columbia (DC)"),
+ ("FL", "Florida (FL)"),
+ ("GA", "Georgia (GA)"),
+ ("GU", "Guam (GU)"),
+ ("HI", "Hawaii (HI)"),
+ ("ID", "Idaho (ID)"),
+ ("IL", "Illinois (IL)"),
+ ("IN", "Indiana (IN)"),
+ ("IA", "Iowa (IA)"),
+ ("KS", "Kansas (KS)"),
+ ("KY", "Kentucky (KY)"),
+ ("LA", "Louisiana (LA)"),
+ ("ME", "Maine (ME)"),
+ ("MD", "Maryland (MD)"),
+ ("MA", "Massachusetts (MA)"),
+ ("MI", "Michigan (MI)"),
+ ("MN", "Minnesota (MN)"),
+ ("MS", "Mississippi (MS)"),
+ ("MO", "Missouri (MO)"),
+ ("MT", "Montana (MT)"),
+ ("NE", "Nebraska (NE)"),
+ ("NV", "Nevada (NV)"),
+ ("NH", "New Hampshire (NH)"),
+ ("NJ", "New Jersey (NJ)"),
+ ("NM", "New Mexico (NM)"),
+ ("NY", "New York (NY)"),
+ ("NC", "North Carolina (NC)"),
+ ("ND", "North Dakota (ND)"),
+ ("MP", "Northern Mariana Islands (MP)"),
+ ("OH", "Ohio (OH)"),
+ ("OK", "Oklahoma (OK)"),
+ ("OR", "Oregon (OR)"),
+ ("PA", "Pennsylvania (PA)"),
+ ("PR", "Puerto Rico (PR)"),
+ ("RI", "Rhode Island (RI)"),
+ ("SC", "South Carolina (SC)"),
+ ("SD", "South Dakota (SD)"),
+ ("TN", "Tennessee (TN)"),
+ ("TX", "Texas (TX)"),
+ ("UM", "United States Minor Outlying Islands (UM)"),
+ ("UT", "Utah (UT)"),
+ ("VT", "Vermont (VT)"),
+ ("VI", "Virgin Islands (VI)"),
+ ("VA", "Virginia (VA)"),
+ ("WA", "Washington (WA)"),
+ ("WV", "West Virginia (WV)"),
+ ("WI", "Wisconsin (WI)"),
+ ("WY", "Wyoming (WY)"),
+ ("AA", "Armed Forces Americas (AA)"),
+ ("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"),
+ ("AP", "Armed Forces Pacific (AP)"),
+ ],
+ help_text="State, territory, or military post",
+ max_length=2,
+ null=True,
+ ),
+ ),
+ migrations.AlterField(
+ model_name="domaininformation",
+ name="federal_agency",
+ field=models.TextField(
+ blank=True,
+ choices=[
+ (
+ "Administrative Conference of the United States",
+ "Administrative Conference of the United States",
+ ),
+ ("Advisory Council on Historic Preservation", "Advisory Council on Historic Preservation"),
+ ("American Battle Monuments Commission", "American Battle Monuments Commission"),
+ ("AMTRAK", "AMTRAK"),
+ ("Appalachian Regional Commission", "Appalachian Regional Commission"),
+ (
+ "Appraisal Subcommittee of the Federal Financial Institutions Examination Council",
+ "Appraisal Subcommittee of the Federal Financial Institutions Examination Council",
+ ),
+ ("Appraisal Subcommittee", "Appraisal Subcommittee"),
+ ("Architect of the Capitol", "Architect of the Capitol"),
+ ("Armed Forces Retirement Home", "Armed Forces Retirement Home"),
+ (
+ "Barry Goldwater Scholarship and Excellence in Education Foundation",
+ "Barry Goldwater Scholarship and Excellence in Education Foundation",
+ ),
+ (
+ "Barry Goldwater Scholarship and Excellence in Education Program",
+ "Barry Goldwater Scholarship and Excellence in Education Program",
+ ),
+ ("Central Intelligence Agency", "Central Intelligence Agency"),
+ ("Chemical Safety Board", "Chemical Safety Board"),
+ ("Christopher Columbus Fellowship Foundation", "Christopher Columbus Fellowship Foundation"),
+ ("Civil Rights Cold Case Records Review Board", "Civil Rights Cold Case Records Review Board"),
+ (
+ "Commission for the Preservation of America's Heritage Abroad",
+ "Commission for the Preservation of America's Heritage Abroad",
+ ),
+ ("Commission of Fine Arts", "Commission of Fine Arts"),
+ (
+ "Committee for Purchase From People Who Are Blind or Severely Disabled",
+ "Committee for Purchase From People Who Are Blind or Severely Disabled",
+ ),
+ ("Commodity Futures Trading Commission", "Commodity Futures Trading Commission"),
+ ("Congressional Budget Office", "Congressional Budget Office"),
+ ("Consumer Financial Protection Bureau", "Consumer Financial Protection Bureau"),
+ ("Consumer Product Safety Commission", "Consumer Product Safety Commission"),
+ ("Corporation for National & Community Service", "Corporation for National & Community Service"),
+ (
+ "Corporation for National and Community Service",
+ "Corporation for National and Community Service",
+ ),
+ (
+ "Council of Inspectors General on Integrity and Efficiency",
+ "Council of Inspectors General on Integrity and Efficiency",
+ ),
+ ("Court Services and Offender Supervision", "Court Services and Offender Supervision"),
+ ("Cyberspace Solarium Commission", "Cyberspace Solarium Commission"),
+ (
+ "DC Court Services and Offender Supervision Agency",
+ "DC Court Services and Offender Supervision Agency",
+ ),
+ ("DC Pre-trial Services", "DC Pre-trial Services"),
+ ("Defense Nuclear Facilities Safety Board", "Defense Nuclear Facilities Safety Board"),
+ ("Delta Regional Authority", "Delta Regional Authority"),
+ ("Denali Commission", "Denali Commission"),
+ ("Department of Agriculture", "Department of Agriculture"),
+ ("Department of Commerce", "Department of Commerce"),
+ ("Department of Defense", "Department of Defense"),
+ ("Department of Education", "Department of Education"),
+ ("Department of Energy", "Department of Energy"),
+ ("Department of Health and Human Services", "Department of Health and Human Services"),
+ ("Department of Homeland Security", "Department of Homeland Security"),
+ ("Department of Housing and Urban Development", "Department of Housing and Urban Development"),
+ ("Department of Justice", "Department of Justice"),
+ ("Department of Labor", "Department of Labor"),
+ ("Department of State", "Department of State"),
+ ("Department of the Interior", "Department of the Interior"),
+ ("Department of the Treasury", "Department of the Treasury"),
+ ("Department of Transportation", "Department of Transportation"),
+ ("Department of Veterans Affairs", "Department of Veterans Affairs"),
+ ("Director of National Intelligence", "Director of National Intelligence"),
+ ("Dwight D. Eisenhower Memorial Commission", "Dwight D. Eisenhower Memorial Commission"),
+ ("Election Assistance Commission", "Election Assistance Commission"),
+ ("Environmental Protection Agency", "Environmental Protection Agency"),
+ ("Equal Employment Opportunity Commission", "Equal Employment Opportunity Commission"),
+ ("Executive Office of the President", "Executive Office of the President"),
+ ("Export-Import Bank of the United States", "Export-Import Bank of the United States"),
+ ("Export/Import Bank of the U.S.", "Export/Import Bank of the U.S."),
+ ("Farm Credit Administration", "Farm Credit Administration"),
+ ("Farm Credit System Insurance Corporation", "Farm Credit System Insurance Corporation"),
+ ("Federal Communications Commission", "Federal Communications Commission"),
+ ("Federal Deposit Insurance Corporation", "Federal Deposit Insurance Corporation"),
+ ("Federal Election Commission", "Federal Election Commission"),
+ ("Federal Energy Regulatory Commission", "Federal Energy Regulatory Commission"),
+ (
+ "Federal Financial Institutions Examination Council",
+ "Federal Financial Institutions Examination Council",
+ ),
+ ("Federal Housing Finance Agency", "Federal Housing Finance Agency"),
+ ("Federal Judiciary", "Federal Judiciary"),
+ ("Federal Labor Relations Authority", "Federal Labor Relations Authority"),
+ ("Federal Maritime Commission", "Federal Maritime Commission"),
+ ("Federal Mediation and Conciliation Service", "Federal Mediation and Conciliation Service"),
+ (
+ "Federal Mine Safety and Health Review Commission",
+ "Federal Mine Safety and Health Review Commission",
+ ),
+ (
+ "Federal Permitting Improvement Steering Council",
+ "Federal Permitting Improvement Steering Council",
+ ),
+ ("Federal Reserve Board of Governors", "Federal Reserve Board of Governors"),
+ ("Federal Reserve System", "Federal Reserve System"),
+ ("Federal Trade Commission", "Federal Trade Commission"),
+ ("General Services Administration", "General Services Administration"),
+ ("gov Administration", "gov Administration"),
+ ("Government Accountability Office", "Government Accountability Office"),
+ ("Government Publishing Office", "Government Publishing Office"),
+ ("Gulf Coast Ecosystem Restoration Council", "Gulf Coast Ecosystem Restoration Council"),
+ ("Harry S Truman Scholarship Foundation", "Harry S Truman Scholarship Foundation"),
+ ("Harry S. Truman Scholarship Foundation", "Harry S. Truman Scholarship Foundation"),
+ ("Institute of Museum and Library Services", "Institute of Museum and Library Services"),
+ ("Institute of Peace", "Institute of Peace"),
+ ("Inter-American Foundation", "Inter-American Foundation"),
+ (
+ "International Boundary and Water Commission: United States and Mexico",
+ "International Boundary and Water Commission: United States and Mexico",
+ ),
+ (
+ "International Boundary Commission: United States and Canada",
+ "International Boundary Commission: United States and Canada",
+ ),
+ (
+ "International Joint Commission: United States and Canada",
+ "International Joint Commission: United States and Canada",
+ ),
+ ("James Madison Memorial Fellowship Foundation", "James Madison Memorial Fellowship Foundation"),
+ ("Japan-United States Friendship Commission", "Japan-United States Friendship Commission"),
+ ("Japan-US Friendship Commission", "Japan-US Friendship Commission"),
+ ("John F. Kennedy Center for Performing Arts", "John F. Kennedy Center for Performing Arts"),
+ (
+ "John F. Kennedy Center for the Performing Arts",
+ "John F. Kennedy Center for the Performing Arts",
+ ),
+ ("Legal Services Corporation", "Legal Services Corporation"),
+ ("Legislative Branch", "Legislative Branch"),
+ ("Library of Congress", "Library of Congress"),
+ ("Marine Mammal Commission", "Marine Mammal Commission"),
+ (
+ "Medicaid and CHIP Payment and Access Commission",
+ "Medicaid and CHIP Payment and Access Commission",
+ ),
+ ("Medical Payment Advisory Commission", "Medical Payment Advisory Commission"),
+ ("Medicare Payment Advisory Commission", "Medicare Payment Advisory Commission"),
+ ("Merit Systems Protection Board", "Merit Systems Protection Board"),
+ ("Millennium Challenge Corporation", "Millennium Challenge Corporation"),
+ (
+ "Morris K. Udall and Stewart L. Udall Foundation",
+ "Morris K. Udall and Stewart L. Udall Foundation",
+ ),
+ ("National Aeronautics and Space Administration", "National Aeronautics and Space Administration"),
+ ("National Archives and Records Administration", "National Archives and Records Administration"),
+ ("National Capital Planning Commission", "National Capital Planning Commission"),
+ ("National Council on Disability", "National Council on Disability"),
+ ("National Credit Union Administration", "National Credit Union Administration"),
+ ("National Endowment for the Arts", "National Endowment for the Arts"),
+ ("National Endowment for the Humanities", "National Endowment for the Humanities"),
+ (
+ "National Foundation on the Arts and the Humanities",
+ "National Foundation on the Arts and the Humanities",
+ ),
+ ("National Gallery of Art", "National Gallery of Art"),
+ ("National Indian Gaming Commission", "National Indian Gaming Commission"),
+ ("National Labor Relations Board", "National Labor Relations Board"),
+ ("National Mediation Board", "National Mediation Board"),
+ ("National Science Foundation", "National Science Foundation"),
+ (
+ "National Security Commission on Artificial Intelligence",
+ "National Security Commission on Artificial Intelligence",
+ ),
+ ("National Transportation Safety Board", "National Transportation Safety Board"),
+ (
+ "Networking Information Technology Research and Development",
+ "Networking Information Technology Research and Development",
+ ),
+ ("Non-Federal Agency", "Non-Federal Agency"),
+ ("Northern Border Regional Commission", "Northern Border Regional Commission"),
+ ("Nuclear Regulatory Commission", "Nuclear Regulatory Commission"),
+ ("Nuclear Safety Oversight Committee", "Nuclear Safety Oversight Committee"),
+ ("Nuclear Waste Technical Review Board", "Nuclear Waste Technical Review Board"),
+ (
+ "Occupational Safety & Health Review Commission",
+ "Occupational Safety & Health Review Commission",
+ ),
+ (
+ "Occupational Safety and Health Review Commission",
+ "Occupational Safety and Health Review Commission",
+ ),
+ ("Office of Compliance", "Office of Compliance"),
+ ("Office of Congressional Workplace Rights", "Office of Congressional Workplace Rights"),
+ ("Office of Government Ethics", "Office of Government Ethics"),
+ ("Office of Navajo and Hopi Indian Relocation", "Office of Navajo and Hopi Indian Relocation"),
+ ("Office of Personnel Management", "Office of Personnel Management"),
+ ("Open World Leadership Center", "Open World Leadership Center"),
+ ("Overseas Private Investment Corporation", "Overseas Private Investment Corporation"),
+ ("Peace Corps", "Peace Corps"),
+ ("Pension Benefit Guaranty Corporation", "Pension Benefit Guaranty Corporation"),
+ ("Postal Regulatory Commission", "Postal Regulatory Commission"),
+ ("Presidio Trust", "Presidio Trust"),
+ ("Privacy and Civil Liberties Oversight Board", "Privacy and Civil Liberties Oversight Board"),
+ ("Public Buildings Reform Board", "Public Buildings Reform Board"),
+ (
+ "Public Defender Service for the District of Columbia",
+ "Public Defender Service for the District of Columbia",
+ ),
+ ("Railroad Retirement Board", "Railroad Retirement Board"),
+ ("Securities and Exchange Commission", "Securities and Exchange Commission"),
+ ("Selective Service System", "Selective Service System"),
+ ("Small Business Administration", "Small Business Administration"),
+ ("Smithsonian Institution", "Smithsonian Institution"),
+ ("Social Security Administration", "Social Security Administration"),
+ ("Social Security Advisory Board", "Social Security Advisory Board"),
+ ("Southeast Crescent Regional Commission", "Southeast Crescent Regional Commission"),
+ ("Southwest Border Regional Commission", "Southwest Border Regional Commission"),
+ ("State Justice Institute", "State Justice Institute"),
+ ("State, Local, and Tribal Government", "State, Local, and Tribal Government"),
+ ("Stennis Center for Public Service", "Stennis Center for Public Service"),
+ ("Surface Transportation Board", "Surface Transportation Board"),
+ ("Tennessee Valley Authority", "Tennessee Valley Authority"),
+ ("The Executive Office of the President", "The Executive Office of the President"),
+ ("The Intelligence Community", "The Intelligence Community"),
+ ("The Legislative Branch", "The Legislative Branch"),
+ ("The Supreme Court", "The Supreme Court"),
+ (
+ "The United States World War One Centennial Commission",
+ "The United States World War One Centennial Commission",
+ ),
+ ("U.S. Access Board", "U.S. Access Board"),
+ ("U.S. Agency for Global Media", "U.S. Agency for Global Media"),
+ ("U.S. Agency for International Development", "U.S. Agency for International Development"),
+ ("U.S. Capitol Police", "U.S. Capitol Police"),
+ ("U.S. Chemical Safety Board", "U.S. Chemical Safety Board"),
+ (
+ "U.S. China Economic and Security Review Commission",
+ "U.S. China Economic and Security Review Commission",
+ ),
+ (
+ "U.S. Commission for the Preservation of Americas Heritage Abroad",
+ "U.S. Commission for the Preservation of Americas Heritage Abroad",
+ ),
+ ("U.S. Commission of Fine Arts", "U.S. Commission of Fine Arts"),
+ ("U.S. Commission on Civil Rights", "U.S. Commission on Civil Rights"),
+ (
+ "U.S. Commission on International Religious Freedom",
+ "U.S. Commission on International Religious Freedom",
+ ),
+ ("U.S. Courts", "U.S. Courts"),
+ ("U.S. Department of Agriculture", "U.S. Department of Agriculture"),
+ ("U.S. Interagency Council on Homelessness", "U.S. Interagency Council on Homelessness"),
+ ("U.S. International Trade Commission", "U.S. International Trade Commission"),
+ ("U.S. Nuclear Waste Technical Review Board", "U.S. Nuclear Waste Technical Review Board"),
+ ("U.S. Office of Special Counsel", "U.S. Office of Special Counsel"),
+ ("U.S. Peace Corps", "U.S. Peace Corps"),
+ ("U.S. Postal Service", "U.S. Postal Service"),
+ ("U.S. Semiquincentennial Commission", "U.S. Semiquincentennial Commission"),
+ ("U.S. Trade and Development Agency", "U.S. Trade and Development Agency"),
+ (
+ "U.S.-China Economic and Security Review Commission",
+ "U.S.-China Economic and Security Review Commission",
+ ),
+ ("Udall Foundation", "Udall Foundation"),
+ ("United States AbilityOne", "United States AbilityOne"),
+ ("United States Access Board", "United States Access Board"),
+ ("United States African Development Foundation", "United States African Development Foundation"),
+ ("United States Agency for Global Media", "United States Agency for Global Media"),
+ ("United States Arctic Research Commission", "United States Arctic Research Commission"),
+ ("United States Global Change Research Program", "United States Global Change Research Program"),
+ ("United States Holocaust Memorial Museum", "United States Holocaust Memorial Museum"),
+ ("United States Institute of Peace", "United States Institute of Peace"),
+ (
+ "United States Interagency Council on Homelessness",
+ "United States Interagency Council on Homelessness",
+ ),
+ (
+ "United States International Development Finance Corporation",
+ "United States International Development Finance Corporation",
+ ),
+ ("United States International Trade Commission", "United States International Trade Commission"),
+ ("United States Postal Service", "United States Postal Service"),
+ ("United States Senate", "United States Senate"),
+ ("United States Trade and Development Agency", "United States Trade and Development Agency"),
+ (
+ "Utah Reclamation Mitigation and Conservation Commission",
+ "Utah Reclamation Mitigation and Conservation Commission",
+ ),
+ ("Vietnam Education Foundation", "Vietnam Education Foundation"),
+ ("Western Hemisphere Drug Policy Commission", "Western Hemisphere Drug Policy Commission"),
+ (
+ "Woodrow Wilson International Center for Scholars",
+ "Woodrow Wilson International Center for Scholars",
+ ),
+ ("World War I Centennial Commission", "World War I Centennial Commission"),
+ ],
+ help_text="Federal agency",
+ null=True,
+ ),
+ ),
+ migrations.AlterField(
+ model_name="domaininformation",
+ name="state_territory",
+ field=models.CharField(
+ blank=True,
+ choices=[
+ ("AL", "Alabama (AL)"),
+ ("AK", "Alaska (AK)"),
+ ("AS", "American Samoa (AS)"),
+ ("AZ", "Arizona (AZ)"),
+ ("AR", "Arkansas (AR)"),
+ ("CA", "California (CA)"),
+ ("CO", "Colorado (CO)"),
+ ("CT", "Connecticut (CT)"),
+ ("DE", "Delaware (DE)"),
+ ("DC", "District of Columbia (DC)"),
+ ("FL", "Florida (FL)"),
+ ("GA", "Georgia (GA)"),
+ ("GU", "Guam (GU)"),
+ ("HI", "Hawaii (HI)"),
+ ("ID", "Idaho (ID)"),
+ ("IL", "Illinois (IL)"),
+ ("IN", "Indiana (IN)"),
+ ("IA", "Iowa (IA)"),
+ ("KS", "Kansas (KS)"),
+ ("KY", "Kentucky (KY)"),
+ ("LA", "Louisiana (LA)"),
+ ("ME", "Maine (ME)"),
+ ("MD", "Maryland (MD)"),
+ ("MA", "Massachusetts (MA)"),
+ ("MI", "Michigan (MI)"),
+ ("MN", "Minnesota (MN)"),
+ ("MS", "Mississippi (MS)"),
+ ("MO", "Missouri (MO)"),
+ ("MT", "Montana (MT)"),
+ ("NE", "Nebraska (NE)"),
+ ("NV", "Nevada (NV)"),
+ ("NH", "New Hampshire (NH)"),
+ ("NJ", "New Jersey (NJ)"),
+ ("NM", "New Mexico (NM)"),
+ ("NY", "New York (NY)"),
+ ("NC", "North Carolina (NC)"),
+ ("ND", "North Dakota (ND)"),
+ ("MP", "Northern Mariana Islands (MP)"),
+ ("OH", "Ohio (OH)"),
+ ("OK", "Oklahoma (OK)"),
+ ("OR", "Oregon (OR)"),
+ ("PA", "Pennsylvania (PA)"),
+ ("PR", "Puerto Rico (PR)"),
+ ("RI", "Rhode Island (RI)"),
+ ("SC", "South Carolina (SC)"),
+ ("SD", "South Dakota (SD)"),
+ ("TN", "Tennessee (TN)"),
+ ("TX", "Texas (TX)"),
+ ("UM", "United States Minor Outlying Islands (UM)"),
+ ("UT", "Utah (UT)"),
+ ("VT", "Vermont (VT)"),
+ ("VI", "Virgin Islands (VI)"),
+ ("VA", "Virginia (VA)"),
+ ("WA", "Washington (WA)"),
+ ("WV", "West Virginia (WV)"),
+ ("WI", "Wisconsin (WI)"),
+ ("WY", "Wyoming (WY)"),
+ ("AA", "Armed Forces Americas (AA)"),
+ ("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"),
+ ("AP", "Armed Forces Pacific (AP)"),
+ ],
+ help_text="State, territory, or military post",
+ max_length=2,
+ null=True,
+ verbose_name="State, territory, or military post",
+ ),
+ ),
+ ]
diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py
index 86b8a0f7a..4a1945678 100644
--- a/src/registrar/models/domain_application.py
+++ b/src/registrar/models/domain_application.py
@@ -409,6 +409,7 @@ class DomainApplication(TimeStampedModel):
)
federal_agency = models.TextField(
+ choices=AGENCY_CHOICES,
null=True,
blank=True,
help_text="Federal agency",
@@ -451,6 +452,7 @@ class DomainApplication(TimeStampedModel):
)
state_territory = models.CharField(
max_length=2,
+ choices=StateTerritoryChoices.choices,
null=True,
blank=True,
help_text="State, territory, or military post",
diff --git a/src/registrar/models/domain_information.py b/src/registrar/models/domain_information.py
index d2bc5c53d..6eef94cf8 100644
--- a/src/registrar/models/domain_information.py
+++ b/src/registrar/models/domain_information.py
@@ -72,6 +72,7 @@ class DomainInformation(TimeStampedModel):
)
federal_agency = models.TextField(
+ choices=AGENCY_CHOICES,
null=True,
blank=True,
help_text="Federal agency",
@@ -116,6 +117,7 @@ class DomainInformation(TimeStampedModel):
)
state_territory = models.CharField(
max_length=2,
+ choices=StateTerritoryChoices.choices,
null=True,
blank=True,
help_text="State, territory, or military post",
From 73a82a0b1bf55667635a6995c51d1d340c98fed2 Mon Sep 17 00:00:00 2001
From: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
Date: Fri, 1 Dec 2023 08:12:54 -0700
Subject: [PATCH 02/22] Create migration-troubleshooting.md
---
docs/developer/migration-troubleshooting.md | 112 ++++++++++++++++++++
1 file changed, 112 insertions(+)
create mode 100644 docs/developer/migration-troubleshooting.md
diff --git a/docs/developer/migration-troubleshooting.md b/docs/developer/migration-troubleshooting.md
new file mode 100644
index 000000000..6b757fdb7
--- /dev/null
+++ b/docs/developer/migration-troubleshooting.md
@@ -0,0 +1,112 @@
+## Troubleshooting
+
+### Your toolkit
+For a general overview, read [this documentation](https://www.algotech.solutions/blog/python/django-migrations-and-how-to-manage-conflicts/)
+
+
+Some common commands:
+- docker-compose exec app bash -- gets you into bash
+- ./manage.py showmigrations -- shows the current migrations that are finished, all should have [x]
+- ./manage.py makemigrations -- makes the migration
+- ./manage.py showmigrations -- now you should see the new/updated migration with a [ ]
+- ./manage.py migrate [folder name here, ie registrar]
+- ./manage.py showmigrations -- the migration changes should now have a [x] by it
+
+
+On occasion, you will need to run this set of commands to refresh your environment:
+docker-compose down
+docker-compose build
+docker-compose up
+
+
+## Scenarios
+
+### Scenario 1: Conflicting migrations on local
+
+If you get conflicting migrations on local, you probably have a new migration on your branch and you merged main which had new migrations as well. Do NOT merge migrations together. Assume your local migration is 40_local_migration and the migration from main is 40_some_migration_from_main:
+Delete 40_local_migration
+Run `docker-compose exec app ./manage.py makemigrations`
+Compose down then up or run `docker-compose exec app ./manage.py migrate`
+You should end up with 40_some_migration_from_main, 41_local_migration
+Alternatively, assuming that the conflicting migrations are not dependent on each other, you can manually edit the migration file such that your new migration is incremented by one (file name, and definition inside the file) but this approach is not recommended.
+
+### Scenario 2: Conflicting migrations on sandbox
+
+You will diagnose when the migrations job on your PR fails and the logs show “conflicting migrations, multiple leaves found” (something like that). This happens when you swap branches on your sandbox that contain diverging leaves (eg: 40_migration_1 and 40_migration_2). The fix is to go into the sandbox, delete one of these leaves, fake run the preceding migration, hand run the remaining previously conflicting leaf, fake run the last migration:
+`cf login -a api.fr.cloud.gov --sso`
+`cf ssh getgov-`
+`/tmp/lifecycle/shell`
+Navigate to and delete the offending migration
+`cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_previous_miration --fake' --name migrate
+`cf run-task getgov- --wait --command 'python manage.py migrate registrar 40_migration_2' --name migrate`
+`cf run-task getgov- --wait --command 'python manage.py migrate registrar 45_last_migration --fake' --name migrate`
+
+
+### Scenario 3: Migrations ran incorrectly, and migrate no longer works (sandbox)
+
+This has happened when updating user perms (so running a new data migration). Something is off with the update on the sandbox and you need to run that last data migration again:
+`cf login -a api.fr.cloud.gov --sso`
+`cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_penultimate_miration --fake' --name migrate`
+`cf run-task getgov- --wait --command 'python manage.py migrate' --name migrate`
+
+
+### Scenario 4: All migrations refuse to load due to existing duplicates on sandboxes
+
+This typically happens with a DB conflict that prevents 001_initial from loading. For instance, let's say all migrations have ran successfully before, and a zero command is ran to reset everything. This can lead to a catastrophic issue with your postgres database.
+
+To diagnose this issue, you will have to manually delete tables using the psql shell environment. If you are in a production environment and cannot lose that data, then you will need some method of backing that up and reattaching it to the table.
+`cf login -a api.fr.cloud.gov --sso`
+Run `cf connect-to-service -no-client getgov-{environment_name} getgov-{environment_name}-database` to open a SSH tunnel
+Run `psql -h localhost -p {port} -U {username} -d {broker_name}`
+Open a new terminal window and run `cf ssh getgov{environment_name}`
+Run `tmp/lifecycle/shell`
+Run `./manage.py migrate` and observe which tables are duplicates
+In the psql instance, run `DROP TABLE {table_name} CASCADE` **WARNING:** this will permanently erase data! Be careful when doing this and exercise common sense.
+Run `./manage.py migrate` again and repeat step 7 for each table which returns this error.
+After these errors are resolved, follow instructions in the other scenarios if applicable.
+
+
+### Scenario 5: Permissions group exist, but my users cannot log onto the sandbox
+
+This is most likely due to fixtures not running or fixtures running before the data creating migration. Simple run fixtures again (WARNING: This applies to dev sandboxes only. We never want to rerun fixtures on a stable environment)
+`cf login -a api.fr.cloud.gov --sso`
+`cf run-task getgov- --command "./manage.py load" --name fixtures`
+
+### Scenario 6: The data is corrupted on the sandbox
+
+Example: there are extra columns created on a table by an old migration long since gone from the code. In that case, you may have to tunnel into your DB on the sandbox and hand-delete these columns. See scenario #4 if you are running into duplicate table definitions. Also see [this documentation](docs/developer/database-access.md) for a good reference here:
+`cf login -a api.fr.cloud.gov --sso`
+Open a new terminal window and run `cf ssh getgov{environment_name}`
+Run `tmp/lifecycle/shell`
+Run `./manage.py migrate` and observe which tables have invalid column definitions
+Run the `\l` command to see all of the databases that are present
+`\c cgawsbrokerprodlgi635s6c0afp8w` (assume cgawsbrokerprodlgi635s6c0afp8w is your DB)
+‘\dt’ to see the tables
+`SELECT * FROM {bad_table};`
+`alter table registrar_domain drop {bad_column};`
+
+
+### Scenario 7: Continual 500 error for the registrar + your requests (login, clicking around, etc) are not showing up in the logstream
+
+Example: You are able to log in and access the /admin page, but when you arrive at the registrar you keep getting 500 errors and your log-ins any API calls you make via the UI does not show up in the log stream. And you feel like you’re starting to lose your marbles.
+
+In the CLI, run the command `cf routes`
+If you notice that your route of `getgov-.app.cloud.gov` is pointing two apps, then that is probably the major issue of the 500 error. (ie mine was pointing at `getgov-.app.cloud.gov` AND `cisa-dotgov`
+In the CLI, run the command `cf apps` to check that it has an app running called `cisa-dotgov`. If so, there’s the error!
+Essentially this shows that your requests were being handled by two completely separate applications and that’s why some requests aren’t being located.
+To resolve this issue, remove the app named `cisa-dotgov` from this space.
+Test out the sandbox from there and it should be working!
+
+Debug connectivity:
+
+dig getgov-rh.app.cloud.gov (domain information groper, gets DNS nameserver information)
+curl -v https://getgov-.app.cloud.gov/ --resolve 'getgov-.app.cloud.gov:' (this gets you access to ping to it)
+You should be able to play around with your sandbox and see from the curl command above that it’s being pinged. This command is basically log stream, but gives you full access to make sure you can ping the sandbox manually
+https://cisa-corp.slack.com/archives/C05BGB4L5NF/p1697810600723069
+
+### Scenario 8: Can’t log into sandbox, permissions do not exist
+
+Fake migrate the migration that’s before the last data creation migration
+Run the last data creation migration (AND ONLY THAT ONE)
+Fake migrate the last migration in the migration list
+Rerun fixtures
From e100a0edbd0e1617b0f0d9fd0c84ce218f690e75 Mon Sep 17 00:00:00 2001
From: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
Date: Fri, 1 Dec 2023 08:30:19 -0700
Subject: [PATCH 03/22] Some formatting
---
docs/developer/migration-troubleshooting.md | 106 ++++++++++++--------
1 file changed, 63 insertions(+), 43 deletions(-)
diff --git a/docs/developer/migration-troubleshooting.md b/docs/developer/migration-troubleshooting.md
index 6b757fdb7..ff451bfdd 100644
--- a/docs/developer/migration-troubleshooting.md
+++ b/docs/developer/migration-troubleshooting.md
@@ -14,40 +14,51 @@ Some common commands:
On occasion, you will need to run this set of commands to refresh your environment:
-docker-compose down
-docker-compose build
-docker-compose up
+- docker-compose down
+- docker-compose build
+- docker-compose up
## Scenarios
### Scenario 1: Conflicting migrations on local
-If you get conflicting migrations on local, you probably have a new migration on your branch and you merged main which had new migrations as well. Do NOT merge migrations together. Assume your local migration is 40_local_migration and the migration from main is 40_some_migration_from_main:
-Delete 40_local_migration
-Run `docker-compose exec app ./manage.py makemigrations`
-Compose down then up or run `docker-compose exec app ./manage.py migrate`
-You should end up with 40_some_migration_from_main, 41_local_migration
+If you get conflicting migrations on local, you probably have a new migration on your branch and you merged main which had new migrations as well. Do NOT merge migrations together.
+
+Assuming your local migration is `40_local_migration` and the migration from main is `40_some_migration_from_main`:
+- Delete `40_local_migration`
+- Run `docker-compose exec app ./manage.py makemigrations`
+- Run `docker-compose down`
+- Run `docker-compose up`
+- Run `docker-compose exec app ./manage.py migrate`
+
+You should end up with `40_some_migration_from_main`, `41_local_migration`
+
Alternatively, assuming that the conflicting migrations are not dependent on each other, you can manually edit the migration file such that your new migration is incremented by one (file name, and definition inside the file) but this approach is not recommended.
### Scenario 2: Conflicting migrations on sandbox
-You will diagnose when the migrations job on your PR fails and the logs show “conflicting migrations, multiple leaves found” (something like that). This happens when you swap branches on your sandbox that contain diverging leaves (eg: 40_migration_1 and 40_migration_2). The fix is to go into the sandbox, delete one of these leaves, fake run the preceding migration, hand run the remaining previously conflicting leaf, fake run the last migration:
-`cf login -a api.fr.cloud.gov --sso`
-`cf ssh getgov-`
-`/tmp/lifecycle/shell`
-Navigate to and delete the offending migration
-`cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_previous_miration --fake' --name migrate
-`cf run-task getgov- --wait --command 'python manage.py migrate registrar 40_migration_2' --name migrate`
-`cf run-task getgov- --wait --command 'python manage.py migrate registrar 45_last_migration --fake' --name migrate`
+This occurs when the logs return the following:
+>Conflicting migrations detected; multiple leaf nodes in the migration graph: (0040_example, 0041_example in base).
+To fix them run 'python manage.py makemigrations --merge'
+This happens when you swap branches on your sandbox that contain diverging leaves (eg: 0040_example, 0041_example). The fix is to go into the sandbox, delete one of these leaves, fake run the preceding migration, hand run the remaining previously conflicting leaf, fake run the last migration:
+
+- `cf login -a api.fr.cloud.gov --sso`
+- `cf ssh getgov-`
+- `/tmp/lifecycle/shell`
+- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_previous_miration --fake' --name migrate`
+- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 41_example_migration' --name migrate`
+- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 45_last_migration --fake' --name migrate`
+
+Then, navigate to and delete the offending migration. In this case, it is 0041_example_migration.
### Scenario 3: Migrations ran incorrectly, and migrate no longer works (sandbox)
This has happened when updating user perms (so running a new data migration). Something is off with the update on the sandbox and you need to run that last data migration again:
-`cf login -a api.fr.cloud.gov --sso`
-`cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_penultimate_miration --fake' --name migrate`
-`cf run-task getgov- --wait --command 'python manage.py migrate' --name migrate`
+- `cf login -a api.fr.cloud.gov --sso`
+- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_penultimate_miration --fake' --name migrate`
+- `cf run-task getgov- --wait --command 'python manage.py migrate' --name migrate`
### Scenario 4: All migrations refuse to load due to existing duplicates on sandboxes
@@ -55,35 +66,44 @@ This has happened when updating user perms (so running a new data migration). So
This typically happens with a DB conflict that prevents 001_initial from loading. For instance, let's say all migrations have ran successfully before, and a zero command is ran to reset everything. This can lead to a catastrophic issue with your postgres database.
To diagnose this issue, you will have to manually delete tables using the psql shell environment. If you are in a production environment and cannot lose that data, then you will need some method of backing that up and reattaching it to the table.
-`cf login -a api.fr.cloud.gov --sso`
-Run `cf connect-to-service -no-client getgov-{environment_name} getgov-{environment_name}-database` to open a SSH tunnel
-Run `psql -h localhost -p {port} -U {username} -d {broker_name}`
-Open a new terminal window and run `cf ssh getgov{environment_name}`
-Run `tmp/lifecycle/shell`
-Run `./manage.py migrate` and observe which tables are duplicates
-In the psql instance, run `DROP TABLE {table_name} CASCADE` **WARNING:** this will permanently erase data! Be careful when doing this and exercise common sense.
-Run `./manage.py migrate` again and repeat step 7 for each table which returns this error.
+
+1. `cf login -a api.fr.cloud.gov --sso`
+2. Run `cf connect-to-service -no-client getgov-{environment_name} getgov-{environment_name}-database` to open a SSH tunnel
+3. Run `psql -h localhost -p {port} -U {username} -d {broker_name}`
+4. Open a new terminal window and run `cf ssh getgov{environment_name}`
+5. Within that window, run `tmp/lifecycle/shell`
+6. Within that window, run `./manage.py migrate` and observe which tables are duplicates
+
+Afterwards, go back to your psql instance. Run the following for each problematic table:
+
+7. `DROP TABLE {table_name} CASCADE`
+
+**WARNING:** this will permanently erase data! Be careful when doing this and exercise common sense.
+
+Then, run `./manage.py migrate` again and repeat step 7 for each table which returns this error.
After these errors are resolved, follow instructions in the other scenarios if applicable.
### Scenario 5: Permissions group exist, but my users cannot log onto the sandbox
This is most likely due to fixtures not running or fixtures running before the data creating migration. Simple run fixtures again (WARNING: This applies to dev sandboxes only. We never want to rerun fixtures on a stable environment)
-`cf login -a api.fr.cloud.gov --sso`
-`cf run-task getgov- --command "./manage.py load" --name fixtures`
-### Scenario 6: The data is corrupted on the sandbox
+- `cf login -a api.fr.cloud.gov --sso`
+- `cf run-task getgov- --command "./manage.py load" --name fixtures`
+
+### Scenario 6: Data is corrupted on the sandbox
Example: there are extra columns created on a table by an old migration long since gone from the code. In that case, you may have to tunnel into your DB on the sandbox and hand-delete these columns. See scenario #4 if you are running into duplicate table definitions. Also see [this documentation](docs/developer/database-access.md) for a good reference here:
-`cf login -a api.fr.cloud.gov --sso`
-Open a new terminal window and run `cf ssh getgov{environment_name}`
-Run `tmp/lifecycle/shell`
-Run `./manage.py migrate` and observe which tables have invalid column definitions
-Run the `\l` command to see all of the databases that are present
-`\c cgawsbrokerprodlgi635s6c0afp8w` (assume cgawsbrokerprodlgi635s6c0afp8w is your DB)
+
+- `cf login -a api.fr.cloud.gov --sso`
+- Open a new terminal window and run `cf ssh getgov{environment_name}`
+- Run `tmp/lifecycle/shell`
+- Run `./manage.py migrate` and observe which tables have invalid column definitions
+- Run the `\l` command to see all of the databases that are present
+- `\c cgawsbrokerprodlgi635s6c0afp8w` (assume cgawsbrokerprodlgi635s6c0afp8w is your DB)
‘\dt’ to see the tables
-`SELECT * FROM {bad_table};`
-`alter table registrar_domain drop {bad_column};`
+- `SELECT * FROM {bad_table};`
+- `alter table registrar_domain drop {bad_column};`
### Scenario 7: Continual 500 error for the registrar + your requests (login, clicking around, etc) are not showing up in the logstream
@@ -97,7 +117,7 @@ Essentially this shows that your requests were being handled by two completely s
To resolve this issue, remove the app named `cisa-dotgov` from this space.
Test out the sandbox from there and it should be working!
-Debug connectivity:
+**Debug connectivity**
dig getgov-rh.app.cloud.gov (domain information groper, gets DNS nameserver information)
curl -v https://getgov-.app.cloud.gov/ --resolve 'getgov-.app.cloud.gov:' (this gets you access to ping to it)
@@ -106,7 +126,7 @@ https://cisa-corp.slack.com/archives/C05BGB4L5NF/p1697810600723069
### Scenario 8: Can’t log into sandbox, permissions do not exist
-Fake migrate the migration that’s before the last data creation migration
-Run the last data creation migration (AND ONLY THAT ONE)
-Fake migrate the last migration in the migration list
-Rerun fixtures
+- Fake migrate the migration that’s before the last data creation migration
+- Run the last data creation migration (AND ONLY THAT ONE)
+- Fake migrate the last migration in the migration list
+- Rerun fixtures
From f5edd64c92d89801b87cb6afd84d090deaa3709c Mon Sep 17 00:00:00 2001
From: Rebecca Hsieh
Date: Mon, 4 Dec 2023 11:35:31 -0800
Subject: [PATCH 04/22] Move manage your domain
---
src/registrar/templates/base.html | 12 +++++++++++-
src/registrar/templates/domain_base.html | 10 ----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/registrar/templates/base.html b/src/registrar/templates/base.html
index caecee9f3..6179798b8 100644
--- a/src/registrar/templates/base.html
+++ b/src/registrar/templates/base.html
@@ -148,8 +148,18 @@
{% block usa_nav %}
From 61e05a438b6a793651ea8a6f9f4bfdaf19d5a940 Mon Sep 17 00:00:00 2001
From: Rachid Mrad
Date: Mon, 4 Dec 2023 15:33:46 -0500
Subject: [PATCH 06/22] Move manage button CSS from buttons to nav partial
---
src/registrar/assets/sass/_theme/_buttons.scss | 11 -----------
src/registrar/assets/sass/_theme/_nav-primary.scss | 11 +++++++++++
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/registrar/assets/sass/_theme/_buttons.scss b/src/registrar/assets/sass/_theme/_buttons.scss
index 8e6aeef56..02089ec6d 100644
--- a/src/registrar/assets/sass/_theme/_buttons.scss
+++ b/src/registrar/assets/sass/_theme/_buttons.scss
@@ -7,17 +7,6 @@ a[href$="todo"]::after {
content: " [link TBD]";
font-style: italic;
}
-
-a.manage_domain_back {
- // Slight vertical and horizontal alignment fixes
- position: relative;
- top: -2px;
- left: -5px;
- font-weight: bold;
- &:visited {
- color: color('primary');
- }
-}
a.breadcrumb__back {
display:flex;
diff --git a/src/registrar/assets/sass/_theme/_nav-primary.scss b/src/registrar/assets/sass/_theme/_nav-primary.scss
index 754abfa2e..72cf35b42 100644
--- a/src/registrar/assets/sass/_theme/_nav-primary.scss
+++ b/src/registrar/assets/sass/_theme/_nav-primary.scss
@@ -7,3 +7,14 @@
.usa-logo-group {
flex: 1 1 0%;
}
+
+a.manage_domain_back {
+ // Slight vertical and horizontal alignment fixes
+ position: relative;
+ top: -2px;
+ left: -5px;
+ font-weight: bold;
+ &:visited {
+ color: color('primary');
+ }
+}
From 7bc77ac4f91221db9d757427cad5f3a6580d95d5 Mon Sep 17 00:00:00 2001
From: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
Date: Mon, 4 Dec 2023 15:28:34 -0700
Subject: [PATCH 07/22] Update migration-troubleshooting.md
---
docs/developer/migration-troubleshooting.md | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/docs/developer/migration-troubleshooting.md b/docs/developer/migration-troubleshooting.md
index ff451bfdd..64d94c520 100644
--- a/docs/developer/migration-troubleshooting.md
+++ b/docs/developer/migration-troubleshooting.md
@@ -13,12 +13,6 @@ Some common commands:
- ./manage.py showmigrations -- the migration changes should now have a [x] by it
-On occasion, you will need to run this set of commands to refresh your environment:
-- docker-compose down
-- docker-compose build
-- docker-compose up
-
-
## Scenarios
### Scenario 1: Conflicting migrations on local
@@ -60,7 +54,6 @@ This has happened when updating user perms (so running a new data migration). So
- `cf run-task getgov- --wait --command 'python manage.py migrate registrar 39_penultimate_miration --fake' --name migrate`
- `cf run-task getgov- --wait --command 'python manage.py migrate' --name migrate`
-
### Scenario 4: All migrations refuse to load due to existing duplicates on sandboxes
This typically happens with a DB conflict that prevents 001_initial from loading. For instance, let's say all migrations have ran successfully before, and a zero command is ran to reset everything. This can lead to a catastrophic issue with your postgres database.
@@ -83,7 +76,6 @@ Afterwards, go back to your psql instance. Run the following for each problemati
Then, run `./manage.py migrate` again and repeat step 7 for each table which returns this error.
After these errors are resolved, follow instructions in the other scenarios if applicable.
-
### Scenario 5: Permissions group exist, but my users cannot log onto the sandbox
This is most likely due to fixtures not running or fixtures running before the data creating migration. Simple run fixtures again (WARNING: This applies to dev sandboxes only. We never want to rerun fixtures on a stable environment)
@@ -105,7 +97,6 @@ Example: there are extra columns created on a table by an old migration long sin
- `SELECT * FROM {bad_table};`
- `alter table registrar_domain drop {bad_column};`
-
### Scenario 7: Continual 500 error for the registrar + your requests (login, clicking around, etc) are not showing up in the logstream
Example: You are able to log in and access the /admin page, but when you arrive at the registrar you keep getting 500 errors and your log-ins any API calls you make via the UI does not show up in the log stream. And you feel like you’re starting to lose your marbles.
From bf3f9e67fc97d371ccdc819ebcd5f6936aa8fdcc Mon Sep 17 00:00:00 2001
From: Rebecca Hsieh
Date: Mon, 4 Dec 2023 14:43:06 -0800
Subject: [PATCH 08/22] Only have Manage Your Domains show up on Domain
Overview page
---
src/registrar/templates/base.html | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/registrar/templates/base.html b/src/registrar/templates/base.html
index 03eec88ac..aad526f37 100644
--- a/src/registrar/templates/base.html
+++ b/src/registrar/templates/base.html
@@ -1,5 +1,7 @@
{# keep this on the first line #}
{% load i18n static %}
+{% load static url_helpers %}
+
@@ -148,13 +150,16 @@
{% block logo %}