-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDP-1382] Remove countries from the flow and delete any reference to…
… it from the database (#455) ### What Remove countries from the flow and delete any reference to it from the database ### Why It's not needed in the flow anymore. Addresses https://stellarorg.atlassian.net/browse/SDP-1382.
- Loading branch information
1 parent
9d0d720
commit e824a74
Showing
48 changed files
with
652 additions
and
1,057 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
236 changes: 236 additions & 0 deletions
236
db/migrations/sdp-migrations/2024-11-01.0-disbursement-drop-country.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
-- This migration drops the countries table and any references to it. | ||
|
||
-- +migrate Up | ||
ALTER TABLE disbursements | ||
DROP COLUMN country_code; | ||
|
||
DROP TABLE countries CASCADE; | ||
|
||
|
||
-- +migrate Down | ||
CREATE TABLE countries ( | ||
code VARCHAR(3) PRIMARY KEY, | ||
name VARCHAR(100) NOT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), | ||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), | ||
deleted_at TIMESTAMP WITH TIME ZONE, | ||
UNIQUE (name), | ||
CONSTRAINT country_code_length_check CHECK (char_length(code) = 3) | ||
); | ||
|
||
INSERT INTO countries | ||
(code, name) | ||
VALUES | ||
('AFG', 'Afghanistan'), | ||
('ALB', 'Albania'), | ||
('DZA', 'Algeria'), | ||
('ASM', 'American Samoa'), | ||
('AND', 'Andorra'), | ||
('AGO', 'Angola'), | ||
('ATG', 'Antigua and Barbuda'), | ||
('ARG', 'Argentina'), | ||
('ARM', 'Armenia'), | ||
('ABW', 'Aruba'), | ||
('AUS', 'Australia'), | ||
('AUT', 'Austria'), | ||
('AZE', 'Azerbaijan'), | ||
('BHS', 'Bahamas'), | ||
('BHR', 'Bahrain'), | ||
('BGD', 'Bangladesh'), | ||
('BRB', 'Barbados'), | ||
('BLR', 'Belarus'), | ||
('BEL', 'Belgium'), | ||
('BLZ', 'Belize'), | ||
('BEN', 'Benin'), | ||
('BMU', 'Bermuda'), | ||
('BTN', 'Bhutan'), | ||
('BOL', 'Bolivia'), | ||
('BIH', 'Bosnia and Herzegovina'), | ||
('BWA', 'Botswana'), | ||
('BRA', 'Brazil'), | ||
('BRN', 'Brunei'), | ||
('BGR', 'Bulgaria'), | ||
('BFA', 'Burkina Faso'), | ||
('BDI', 'Burundi'), | ||
('CPV', 'Cabo Verde'), | ||
('KHM', 'Cambodia'), | ||
('CMR', 'Cameroon'), | ||
('CAN', 'Canada'), | ||
('CAF', 'Central African Republic'), | ||
('TCD', 'Chad'), | ||
('CHL', 'Chile'), | ||
('CHN', 'China'), | ||
('COL', 'Colombia'), | ||
('COM', 'Comoros (the)'), | ||
('COG', 'Congo (the)'), | ||
('COK', 'Cook Islands (the)'), | ||
('CRI', 'Costa Rica'), | ||
('HRV', 'Croatia'), | ||
('CYP', 'Cyprus'), | ||
('CZE', 'Czechia'), | ||
('CIV', 'Côte d''Ivoire (Ivory Coast)'), | ||
('COD', 'Democratic Republic of the Congo'), | ||
('DNK', 'Denmark'), | ||
('DJI', 'Djibouti'), | ||
('DMA', 'Dominica'), | ||
('DOM', 'Dominican Republic'), | ||
('ECU', 'Ecuador'), | ||
('EGY', 'Egypt'), | ||
('SLV', 'El Salvador'), | ||
('GNQ', 'Equatorial Guinea'), | ||
('ERI', 'Eritrea'), | ||
('EST', 'Estonia'), | ||
('SWZ', 'Eswatini'), | ||
('ETH', 'Ethiopia'), | ||
('FJI', 'Fiji'), | ||
('FIN', 'Finland'), | ||
('FRA', 'France'), | ||
('GUF', 'French Guiana'), | ||
('PYF', 'French Polynesia'), | ||
('ATF', 'French Southern Territories (the)'), | ||
('GAB', 'Gabon'), | ||
('GMB', 'Gambia (the)'), | ||
('GEO', 'Georgia'), | ||
('DEU', 'Germany'), | ||
('GHA', 'Ghana'), | ||
('GRC', 'Greece'), | ||
('GRL', 'Greenland'), | ||
('GRD', 'Grenada'), | ||
('GUM', 'Guam'), | ||
('GTM', 'Guatemala'), | ||
('GIN', 'Guinea'), | ||
('GNB', 'Guinea-Bissau'), | ||
('GUY', 'Guyana'), | ||
('HTI', 'Haiti'), | ||
('HND', 'Honduras'), | ||
('HUN', 'Hungary'), | ||
('ISL', 'Iceland'), | ||
('IND', 'India'), | ||
('IDN', 'Indonesia'), | ||
('IRQ', 'Iraq'), | ||
('IRL', 'Ireland'), | ||
('ISR', 'Israel'), | ||
('ITA', 'Italy'), | ||
('JAM', 'Jamaica'), | ||
('JPN', 'Japan'), | ||
('JOR', 'Jordan'), | ||
('KAZ', 'Kazakhstan'), | ||
('KEN', 'Kenya'), | ||
('KIR', 'Kiribati'), | ||
('KOR', 'South Korea'), | ||
('KWT', 'Kuwait'), | ||
('KGZ', 'Kyrgyzstan'), | ||
('LAO', 'Laos'), | ||
('LVA', 'Latvia'), | ||
('LBN', 'Lebanon'), | ||
('LSO', 'Lesotho'), | ||
('LBR', 'Liberia'), | ||
('LBY', 'Libya'), | ||
('LIE', 'Liechtenstein'), | ||
('LTU', 'Lithuania'), | ||
('LUX', 'Luxembourg'), | ||
('MDG', 'Madagascar'), | ||
('MWI', 'Malawi'), | ||
('MYS', 'Malaysia'), | ||
('MDV', 'Maldives'), | ||
('MLI', 'Mali'), | ||
('MLT', 'Malta'), | ||
('MHL', 'Marshall Islands (the)'), | ||
('MTQ', 'Martinique'), | ||
('MRT', 'Mauritania'), | ||
('MUS', 'Mauritius'), | ||
('MEX', 'Mexico'), | ||
('FSM', 'Micronesia'), | ||
('MDA', 'Moldova'), | ||
('MCO', 'Monaco'), | ||
('MNG', 'Mongolia'), | ||
('MNE', 'Montenegro'), | ||
('MAR', 'Morocco'), | ||
('MOZ', 'Mozambique'), | ||
('MMR', 'Myanmar'), | ||
('NAM', 'Namibia'), | ||
('NRU', 'Nauru'), | ||
('NPL', 'Nepal'), | ||
('NLD', 'Netherlands (the)'), | ||
('NZL', 'New Zealand'), | ||
('NIC', 'Nicaragua'), | ||
('NER', 'Niger'), | ||
('NGA', 'Nigeria'), | ||
('MKD', 'North Macedonia (Republic of)'), | ||
('NOR', 'Norway'), | ||
('OMN', 'Oman'), | ||
('PAK', 'Pakistan'), | ||
('PLW', 'Palau'), | ||
('PAN', 'Panama'), | ||
('PNG', 'Papua New Guinea'), | ||
('PRY', 'Paraguay'), | ||
('PER', 'Peru'), | ||
('PHL', 'Philippines (the)'), | ||
('POL', 'Poland'), | ||
('PRT', 'Portugal'), | ||
('PRI', 'Puerto Rico'), | ||
('QAT', 'Qatar'), | ||
('ROU', 'Romania'), | ||
('RUS', 'Russia'), | ||
('RWA', 'Rwanda'), | ||
('REU', 'Réunion'), | ||
('BLM', 'Saint Barts'), | ||
('KNA', 'Saint Kitts and Nevis'), | ||
('LCA', 'Saint Lucia'), | ||
('MAF', 'Saint Martin'), | ||
('VCT', 'Saint Vincent and the Grenadines'), | ||
('WSM', 'Samoa'), | ||
('SMR', 'San Marino'), | ||
('STP', 'Sao Tome and Principe'), | ||
('SAU', 'Saudi Arabia'), | ||
('SEN', 'Senegal'), | ||
('SRB', 'Serbia'), | ||
('SYC', 'Seychelles'), | ||
('SLE', 'Sierra Leone'), | ||
('SGP', 'Singapore'), | ||
('SVK', 'Slovakia'), | ||
('SVN', 'Slovenia'), | ||
('SLB', 'Solomon Islands'), | ||
('SOM', 'Somalia'), | ||
('ZAF', 'South Africa'), | ||
('SSD', 'South Sudan'), | ||
('ESP', 'Spain'), | ||
('LKA', 'Sri Lanka'), | ||
('SDN', 'Sudan (the)'), | ||
('SUR', 'Suriname'), | ||
('SWE', 'Sweden'), | ||
('CHE', 'Switzerland'), | ||
('TWN', 'Taiwan'), | ||
('TJK', 'Tajikistan'), | ||
('TZA', 'Tanzania'), | ||
('THA', 'Thailand'), | ||
('TLS', 'Timor-Leste'), | ||
('TGO', 'Togo'), | ||
('TON', 'Tonga'), | ||
('TTO', 'Trinidad and Tobago'), | ||
('TUN', 'Tunisia'), | ||
('TUR', 'Turkey'), | ||
('TKM', 'Turkmenistan'), | ||
('TCA', 'Turks and Caicos Islands'), | ||
('TUV', 'Tuvalu'), | ||
('UGA', 'Uganda'), | ||
('UKR', 'Ukraine'), | ||
('ARE', 'United Arab Emirates'), | ||
('GBR', 'United Kingdom'), | ||
('UMI', 'United States Minor Outlying Islands'), | ||
('USA', 'United States of America'), | ||
('URY', 'Uruguay'), | ||
('UZB', 'Uzbekistan'), | ||
('VUT', 'Vanuatu'), | ||
('VEN', 'Venezuela'), | ||
('VNM', 'Vietnam'), | ||
('VGB', 'Virgin Islands (British)'), | ||
('VIR', 'Virgin Islands (U.S.)'), | ||
('YEM', 'Yemen'), | ||
('ZMB', 'Zambia'), | ||
('ZWE', 'Zimbabwe') | ||
ON CONFLICT DO NOTHING; | ||
|
||
ALTER TABLE disbursements | ||
ADD COLUMN country_code VARCHAR(3), | ||
ADD CONSTRAINT fk_disbursement_country_code FOREIGN KEY (country_code) REFERENCES countries (code); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.