Skip to content

Instantly share code, notes, and snippets.

@tobsn
Created August 1, 2012 23:18
Show Gist options
  • Save tobsn/3231502 to your computer and use it in GitHub Desktop.
Save tobsn/3231502 to your computer and use it in GitHub Desktop.
laravel migration for country codes table
<?php
class Create_Country_Codes_Table {
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
Schema::create('countrycodes', function($table){
$table->increments('id')->unsigned();
$table->string('code',2)->unique();
$table->string('country');
});
DB::table('countrycodes')->insert(array('code'=>'AF','country'=>'Afghanistan'));
DB::table('countrycodes')->insert(array('code'=>'AL','country'=>'Albania'));
DB::table('countrycodes')->insert(array('code'=>'DZ','country'=>'Algeria'));
DB::table('countrycodes')->insert(array('code'=>'AS','country'=>'American Samoa'));
DB::table('countrycodes')->insert(array('code'=>'AD','country'=>'Andorra'));
DB::table('countrycodes')->insert(array('code'=>'AO','country'=>'Angola'));
DB::table('countrycodes')->insert(array('code'=>'AI','country'=>'Anguilla'));
DB::table('countrycodes')->insert(array('code'=>'AQ','country'=>'Antarctica'));
DB::table('countrycodes')->insert(array('code'=>'AG','country'=>'Antigua and Barbuda'));
DB::table('countrycodes')->insert(array('code'=>'AR','country'=>'Argentina'));
DB::table('countrycodes')->insert(array('code'=>'AM','country'=>'Armenia'));
DB::table('countrycodes')->insert(array('code'=>'AW','country'=>'Aruba'));
DB::table('countrycodes')->insert(array('code'=>'AU','country'=>'Australia'));
DB::table('countrycodes')->insert(array('code'=>'AT','country'=>'Austria'));
DB::table('countrycodes')->insert(array('code'=>'AZ','country'=>'Azerbaijan'));
DB::table('countrycodes')->insert(array('code'=>'BS','country'=>'Bahamas'));
DB::table('countrycodes')->insert(array('code'=>'BH','country'=>'Bahrain'));
DB::table('countrycodes')->insert(array('code'=>'BD','country'=>'Bangladesh'));
DB::table('countrycodes')->insert(array('code'=>'BB','country'=>'Barbados'));
DB::table('countrycodes')->insert(array('code'=>'BY','country'=>'Belarus'));
DB::table('countrycodes')->insert(array('code'=>'BE','country'=>'Belgium'));
DB::table('countrycodes')->insert(array('code'=>'BZ','country'=>'Belize'));
DB::table('countrycodes')->insert(array('code'=>'BJ','country'=>'Benin'));
DB::table('countrycodes')->insert(array('code'=>'BM','country'=>'Bermuda'));
DB::table('countrycodes')->insert(array('code'=>'BT','country'=>'Bhutan'));
DB::table('countrycodes')->insert(array('code'=>'BO','country'=>'Bolivia'));
DB::table('countrycodes')->insert(array('code'=>'BA','country'=>'Bosnia and Herzegovina'));
DB::table('countrycodes')->insert(array('code'=>'BW','country'=>'Botswana'));
DB::table('countrycodes')->insert(array('code'=>'BV','country'=>'Bouvet Island'));
DB::table('countrycodes')->insert(array('code'=>'BR','country'=>'Brazil'));
DB::table('countrycodes')->insert(array('code'=>'IO','country'=>'British Indian Ocean Territory'));
DB::table('countrycodes')->insert(array('code'=>'VG','country'=>'British Virgin Islands'));
DB::table('countrycodes')->insert(array('code'=>'BN','country'=>'Brunei Darussalam'));
DB::table('countrycodes')->insert(array('code'=>'BG','country'=>'Bulgaria'));
DB::table('countrycodes')->insert(array('code'=>'BF','country'=>'Burkina Faso'));
DB::table('countrycodes')->insert(array('code'=>'BI','country'=>'Burundi'));
DB::table('countrycodes')->insert(array('code'=>'KH','country'=>'Cambodia'));
DB::table('countrycodes')->insert(array('code'=>'CM','country'=>'Cameroon'));
DB::table('countrycodes')->insert(array('code'=>'CA','country'=>'Canada'));
DB::table('countrycodes')->insert(array('code'=>'CV','country'=>'Cape Verde'));
DB::table('countrycodes')->insert(array('code'=>'KY','country'=>'Cayman Islands'));
DB::table('countrycodes')->insert(array('code'=>'CF','country'=>'Central African Republic'));
DB::table('countrycodes')->insert(array('code'=>'TD','country'=>'Chad'));
DB::table('countrycodes')->insert(array('code'=>'CL','country'=>'Chile'));
DB::table('countrycodes')->insert(array('code'=>'CN','country'=>'China'));
DB::table('countrycodes')->insert(array('code'=>'CX','country'=>'Christmas Island'));
DB::table('countrycodes')->insert(array('code'=>'CC','country'=>'Cocos'));
DB::table('countrycodes')->insert(array('code'=>'CO','country'=>'Colombia'));
DB::table('countrycodes')->insert(array('code'=>'KM','country'=>'Comoros'));
DB::table('countrycodes')->insert(array('code'=>'CD','country'=>'Congo'));
DB::table('countrycodes')->insert(array('code'=>'CG','country'=>'Congo'));
DB::table('countrycodes')->insert(array('code'=>'CK','country'=>'Cook Islands'));
DB::table('countrycodes')->insert(array('code'=>'CR','country'=>'Costa Rica'));
DB::table('countrycodes')->insert(array('code'=>'CI','country'=>'Cote D\'Ivoire'));
DB::table('countrycodes')->insert(array('code'=>'CU','country'=>'Cuba'));
DB::table('countrycodes')->insert(array('code'=>'CY','country'=>'Cyprus'));
DB::table('countrycodes')->insert(array('code'=>'CZ','country'=>'Czech Republic'));
DB::table('countrycodes')->insert(array('code'=>'DK','country'=>'Denmark'));
DB::table('countrycodes')->insert(array('code'=>'DJ','country'=>'Djibouti'));
DB::table('countrycodes')->insert(array('code'=>'DM','country'=>'Dominica'));
DB::table('countrycodes')->insert(array('code'=>'DO','country'=>'Dominican Republic'));
DB::table('countrycodes')->insert(array('code'=>'EC','country'=>'Ecuador'));
DB::table('countrycodes')->insert(array('code'=>'EG','country'=>'Egypt'));
DB::table('countrycodes')->insert(array('code'=>'SV','country'=>'El Salvador'));
DB::table('countrycodes')->insert(array('code'=>'GQ','country'=>'Equatorial Guinea'));
DB::table('countrycodes')->insert(array('code'=>'ER','country'=>'Eritrea'));
DB::table('countrycodes')->insert(array('code'=>'EE','country'=>'Estonia'));
DB::table('countrycodes')->insert(array('code'=>'ET','country'=>'Ethiopia'));
DB::table('countrycodes')->insert(array('code'=>'FO','country'=>'Faeroe Islands'));
DB::table('countrycodes')->insert(array('code'=>'FK','country'=>'Falkland Islands'));
DB::table('countrycodes')->insert(array('code'=>'FJ','country'=>'Fiji'));
DB::table('countrycodes')->insert(array('code'=>'FI','country'=>'Finland'));
DB::table('countrycodes')->insert(array('code'=>'FR','country'=>'France'));
DB::table('countrycodes')->insert(array('code'=>'GF','country'=>'French Guiana'));
DB::table('countrycodes')->insert(array('code'=>'PF','country'=>'French Polynesia'));
DB::table('countrycodes')->insert(array('code'=>'TF','country'=>'French Southern Territories'));
DB::table('countrycodes')->insert(array('code'=>'GA','country'=>'Gabon'));
DB::table('countrycodes')->insert(array('code'=>'GM','country'=>'Gambia'));
DB::table('countrycodes')->insert(array('code'=>'GE','country'=>'Georgia'));
DB::table('countrycodes')->insert(array('code'=>'DE','country'=>'Germany'));
DB::table('countrycodes')->insert(array('code'=>'GH','country'=>'Ghana'));
DB::table('countrycodes')->insert(array('code'=>'GI','country'=>'Gibraltar'));
DB::table('countrycodes')->insert(array('code'=>'GR','country'=>'Greece'));
DB::table('countrycodes')->insert(array('code'=>'GL','country'=>'Greenland'));
DB::table('countrycodes')->insert(array('code'=>'GD','country'=>'Grenada'));
DB::table('countrycodes')->insert(array('code'=>'GP','country'=>'Guadaloupe'));
DB::table('countrycodes')->insert(array('code'=>'GU','country'=>'Guam'));
DB::table('countrycodes')->insert(array('code'=>'GT','country'=>'Guatemala'));
DB::table('countrycodes')->insert(array('code'=>'GN','country'=>'Guinea'));
DB::table('countrycodes')->insert(array('code'=>'GW','country'=>'Guinea-Bissau'));
DB::table('countrycodes')->insert(array('code'=>'GY','country'=>'Guyana'));
DB::table('countrycodes')->insert(array('code'=>'HT','country'=>'Haiti'));
DB::table('countrycodes')->insert(array('code'=>'HM','country'=>'Heard and McDonald Islands'));
DB::table('countrycodes')->insert(array('code'=>'VA','country'=>'Holy See'));
DB::table('countrycodes')->insert(array('code'=>'HN','country'=>'Honduras'));
DB::table('countrycodes')->insert(array('code'=>'HK','country'=>'Hong Kong'));
DB::table('countrycodes')->insert(array('code'=>'HR','country'=>'Hrvatska'));
DB::table('countrycodes')->insert(array('code'=>'HU','country'=>'Hungary'));
DB::table('countrycodes')->insert(array('code'=>'IS','country'=>'Iceland'));
DB::table('countrycodes')->insert(array('code'=>'IN','country'=>'India'));
DB::table('countrycodes')->insert(array('code'=>'ID','country'=>'Indonesia'));
DB::table('countrycodes')->insert(array('code'=>'IR','country'=>'Iran'));
DB::table('countrycodes')->insert(array('code'=>'IQ','country'=>'Iraq'));
DB::table('countrycodes')->insert(array('code'=>'IE','country'=>'Ireland'));
DB::table('countrycodes')->insert(array('code'=>'IL','country'=>'Israel'));
DB::table('countrycodes')->insert(array('code'=>'IT','country'=>'Italy'));
DB::table('countrycodes')->insert(array('code'=>'JM','country'=>'Jamaica'));
DB::table('countrycodes')->insert(array('code'=>'JP','country'=>'Japan'));
DB::table('countrycodes')->insert(array('code'=>'JO','country'=>'Jordan'));
DB::table('countrycodes')->insert(array('code'=>'KZ','country'=>'Kazakhstan'));
DB::table('countrycodes')->insert(array('code'=>'KE','country'=>'Kenya'));
DB::table('countrycodes')->insert(array('code'=>'KI','country'=>'Kiribati'));
DB::table('countrycodes')->insert(array('code'=>'KP','country'=>'Korea'));
DB::table('countrycodes')->insert(array('code'=>'KR','country'=>'Korea'));
DB::table('countrycodes')->insert(array('code'=>'KW','country'=>'Kuwait'));
DB::table('countrycodes')->insert(array('code'=>'KG','country'=>'Kyrgyz Republic'));
DB::table('countrycodes')->insert(array('code'=>'LA','country'=>'Lao People\'s Democratic Republic'));
DB::table('countrycodes')->insert(array('code'=>'LV','country'=>'Latvia'));
DB::table('countrycodes')->insert(array('code'=>'LB','country'=>'Lebanon'));
DB::table('countrycodes')->insert(array('code'=>'LS','country'=>'Lesotho'));
DB::table('countrycodes')->insert(array('code'=>'LR','country'=>'Liberia'));
DB::table('countrycodes')->insert(array('code'=>'LY','country'=>'Libyan Arab Jamahiriya'));
DB::table('countrycodes')->insert(array('code'=>'LI','country'=>'Liechtenstein'));
DB::table('countrycodes')->insert(array('code'=>'LT','country'=>'Lithuania'));
DB::table('countrycodes')->insert(array('code'=>'LU','country'=>'Luxembourg'));
DB::table('countrycodes')->insert(array('code'=>'MO','country'=>'Macao'));
DB::table('countrycodes')->insert(array('code'=>'MK','country'=>'Macedonia'));
DB::table('countrycodes')->insert(array('code'=>'MG','country'=>'Madagascar'));
DB::table('countrycodes')->insert(array('code'=>'MW','country'=>'Malawi'));
DB::table('countrycodes')->insert(array('code'=>'MY','country'=>'Malaysia'));
DB::table('countrycodes')->insert(array('code'=>'MV','country'=>'Maldives'));
DB::table('countrycodes')->insert(array('code'=>'ML','country'=>'Mali'));
DB::table('countrycodes')->insert(array('code'=>'MT','country'=>'Malta'));
DB::table('countrycodes')->insert(array('code'=>'MH','country'=>'Marshall Islands'));
DB::table('countrycodes')->insert(array('code'=>'MQ','country'=>'Martinique'));
DB::table('countrycodes')->insert(array('code'=>'MR','country'=>'Mauritania'));
DB::table('countrycodes')->insert(array('code'=>'MU','country'=>'Mauritius'));
DB::table('countrycodes')->insert(array('code'=>'YT','country'=>'Mayotte'));
DB::table('countrycodes')->insert(array('code'=>'MX','country'=>'Mexico'));
DB::table('countrycodes')->insert(array('code'=>'FM','country'=>'Micronesia'));
DB::table('countrycodes')->insert(array('code'=>'MD','country'=>'Moldova'));
DB::table('countrycodes')->insert(array('code'=>'MC','country'=>'Monaco'));
DB::table('countrycodes')->insert(array('code'=>'MN','country'=>'Mongolia'));
DB::table('countrycodes')->insert(array('code'=>'MS','country'=>'Montserrat'));
DB::table('countrycodes')->insert(array('code'=>'MA','country'=>'Morocco'));
DB::table('countrycodes')->insert(array('code'=>'MZ','country'=>'Mozambique'));
DB::table('countrycodes')->insert(array('code'=>'MM','country'=>'Myanmar'));
DB::table('countrycodes')->insert(array('code'=>'NA','country'=>'Namibia'));
DB::table('countrycodes')->insert(array('code'=>'NR','country'=>'Nauru'));
DB::table('countrycodes')->insert(array('code'=>'NP','country'=>'Nepal'));
DB::table('countrycodes')->insert(array('code'=>'AN','country'=>'Netherlands Antilles'));
DB::table('countrycodes')->insert(array('code'=>'NL','country'=>'Netherlands'));
DB::table('countrycodes')->insert(array('code'=>'NC','country'=>'New Caledonia'));
DB::table('countrycodes')->insert(array('code'=>'NZ','country'=>'New Zealand'));
DB::table('countrycodes')->insert(array('code'=>'NI','country'=>'Nicaragua'));
DB::table('countrycodes')->insert(array('code'=>'NE','country'=>'Niger'));
DB::table('countrycodes')->insert(array('code'=>'NG','country'=>'Nigeria'));
DB::table('countrycodes')->insert(array('code'=>'NU','country'=>'Niue'));
DB::table('countrycodes')->insert(array('code'=>'NF','country'=>'Norfolk Island'));
DB::table('countrycodes')->insert(array('code'=>'MP','country'=>'Northern Mariana Islands'));
DB::table('countrycodes')->insert(array('code'=>'NO','country'=>'Norway'));
DB::table('countrycodes')->insert(array('code'=>'OM','country'=>'Oman'));
DB::table('countrycodes')->insert(array('code'=>'PK','country'=>'Pakistan'));
DB::table('countrycodes')->insert(array('code'=>'PW','country'=>'Palau'));
DB::table('countrycodes')->insert(array('code'=>'PS','country'=>'Palestinian Territory'));
DB::table('countrycodes')->insert(array('code'=>'PA','country'=>'Panama'));
DB::table('countrycodes')->insert(array('code'=>'PG','country'=>'Papua New Guinea'));
DB::table('countrycodes')->insert(array('code'=>'PY','country'=>'Paraguay'));
DB::table('countrycodes')->insert(array('code'=>'PE','country'=>'Peru'));
DB::table('countrycodes')->insert(array('code'=>'PH','country'=>'Philippines'));
DB::table('countrycodes')->insert(array('code'=>'PN','country'=>'Pitcairn Island'));
DB::table('countrycodes')->insert(array('code'=>'PL','country'=>'Poland'));
DB::table('countrycodes')->insert(array('code'=>'PT','country'=>'Portugal'));
DB::table('countrycodes')->insert(array('code'=>'PR','country'=>'Puerto Rico'));
DB::table('countrycodes')->insert(array('code'=>'QA','country'=>'Qatar'));
DB::table('countrycodes')->insert(array('code'=>'RE','country'=>'Reunion'));
DB::table('countrycodes')->insert(array('code'=>'RO','country'=>'Romania'));
DB::table('countrycodes')->insert(array('code'=>'RU','country'=>'Russian Federation'));
DB::table('countrycodes')->insert(array('code'=>'RW','country'=>'Rwanda'));
DB::table('countrycodes')->insert(array('code'=>'SH','country'=>'St. Helena'));
DB::table('countrycodes')->insert(array('code'=>'KN','country'=>'St. Kitts and Nevis'));
DB::table('countrycodes')->insert(array('code'=>'LC','country'=>'St. Lucia'));
DB::table('countrycodes')->insert(array('code'=>'PM','country'=>'St. Pierre and Miquelon'));
DB::table('countrycodes')->insert(array('code'=>'VC','country'=>'St. Vincent and the Grenadines'));
DB::table('countrycodes')->insert(array('code'=>'WS','country'=>'Samoa'));
DB::table('countrycodes')->insert(array('code'=>'SM','country'=>'San Marino'));
DB::table('countrycodes')->insert(array('code'=>'ST','country'=>'Sao Tome and Principe'));
DB::table('countrycodes')->insert(array('code'=>'SA','country'=>'Saudi Arabia'));
DB::table('countrycodes')->insert(array('code'=>'SN','country'=>'Senegal'));
DB::table('countrycodes')->insert(array('code'=>'CS','country'=>'Serbia and Montenegro'));
DB::table('countrycodes')->insert(array('code'=>'SC','country'=>'Seychelles'));
DB::table('countrycodes')->insert(array('code'=>'SL','country'=>'Sierra Leone'));
DB::table('countrycodes')->insert(array('code'=>'SG','country'=>'Singapore'));
DB::table('countrycodes')->insert(array('code'=>'SK','country'=>'Slovakia'));
DB::table('countrycodes')->insert(array('code'=>'SI','country'=>'Slovenia'));
DB::table('countrycodes')->insert(array('code'=>'SB','country'=>'Solomon Islands'));
DB::table('countrycodes')->insert(array('code'=>'SO','country'=>'Somalia'));
DB::table('countrycodes')->insert(array('code'=>'ZA','country'=>'South Africa'));
DB::table('countrycodes')->insert(array('code'=>'GS','country'=>'South Georgia and the South Sandwich Islands'));
DB::table('countrycodes')->insert(array('code'=>'ES','country'=>'Spain'));
DB::table('countrycodes')->insert(array('code'=>'LK','country'=>'Sri Lanka'));
DB::table('countrycodes')->insert(array('code'=>'SD','country'=>'Sudan'));
DB::table('countrycodes')->insert(array('code'=>'SR','country'=>'Suriname'));
DB::table('countrycodes')->insert(array('code'=>'SJ','country'=>'Svalbard & Jan Mayen Islands'));
DB::table('countrycodes')->insert(array('code'=>'SZ','country'=>'Swaziland'));
DB::table('countrycodes')->insert(array('code'=>'SE','country'=>'Sweden'));
DB::table('countrycodes')->insert(array('code'=>'CH','country'=>'Switzerland'));
DB::table('countrycodes')->insert(array('code'=>'SY','country'=>'Syrian Arab Republic'));
DB::table('countrycodes')->insert(array('code'=>'TW','country'=>'Taiwan'));
DB::table('countrycodes')->insert(array('code'=>'TJ','country'=>'Tajikistan'));
DB::table('countrycodes')->insert(array('code'=>'TZ','country'=>'Tanzania'));
DB::table('countrycodes')->insert(array('code'=>'TH','country'=>'Thailand'));
DB::table('countrycodes')->insert(array('code'=>'TL','country'=>'Timor-Leste'));
DB::table('countrycodes')->insert(array('code'=>'TG','country'=>'Togo'));
DB::table('countrycodes')->insert(array('code'=>'TK','country'=>'Tokelau'));
DB::table('countrycodes')->insert(array('code'=>'TO','country'=>'Tonga'));
DB::table('countrycodes')->insert(array('code'=>'TT','country'=>'Trinidad and Tobago'));
DB::table('countrycodes')->insert(array('code'=>'TN','country'=>'Tunisia'));
DB::table('countrycodes')->insert(array('code'=>'TR','country'=>'Turkey'));
DB::table('countrycodes')->insert(array('code'=>'TM','country'=>'Turkmenistan'));
DB::table('countrycodes')->insert(array('code'=>'TC','country'=>'Turks and Caicos Islands'));
DB::table('countrycodes')->insert(array('code'=>'TV','country'=>'Tuvalu'));
DB::table('countrycodes')->insert(array('code'=>'VI','country'=>'US Virgin Islands'));
DB::table('countrycodes')->insert(array('code'=>'UG','country'=>'Uganda'));
DB::table('countrycodes')->insert(array('code'=>'UA','country'=>'Ukraine'));
DB::table('countrycodes')->insert(array('code'=>'AE','country'=>'United Arab Emirates'));
DB::table('countrycodes')->insert(array('code'=>'GB','country'=>'United Kingdom of Great Britain & N. Ireland'));
DB::table('countrycodes')->insert(array('code'=>'UM','country'=>'United States Minor Outlying Islands'));
DB::table('countrycodes')->insert(array('code'=>'US','country'=>'United States of America'));
DB::table('countrycodes')->insert(array('code'=>'UY','country'=>'Uruguay'));
DB::table('countrycodes')->insert(array('code'=>'UZ','country'=>'Uzbekistan'));
DB::table('countrycodes')->insert(array('code'=>'VU','country'=>'Vanuatu'));
DB::table('countrycodes')->insert(array('code'=>'VE','country'=>'Venezuela'));
DB::table('countrycodes')->insert(array('code'=>'VN','country'=>'Viet Nam'));
DB::table('countrycodes')->insert(array('code'=>'WF','country'=>'Wallis and Futuna Islands'));
DB::table('countrycodes')->insert(array('code'=>'EH','country'=>'Western Sahara'));
DB::table('countrycodes')->insert(array('code'=>'YE','country'=>'Yemen'));
DB::table('countrycodes')->insert(array('code'=>'ZM','country'=>'Zambia'));
DB::table('countrycodes')->insert(array('code'=>'ZW','country'=>'Zimbabwe'));
}
/**
* Revert the changes to the database.
*
* @return void
*/
public function down()
{
Schema::drop('countrycodes');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment