Skip to main content

Guide to Adding Curaçao Cities in Production

This guide explains how to safely add all Curaçao cities in the production environment.

✅ Safety Features

The cities:add-curacao command is designed to be 100% safe in production:
  • Does not delete data: Only adds cities, never deletes or modifies existing data
  • Idempotent: Can be run multiple times without issues
  • Transactional: Uses database transactions (if an error occurs, everything is rolled back)
  • Checks for duplicates: Verifies whether cities already exist before adding them
  • Dry-run mode: Lets you preview what would be added without making real changes

📋 Prerequisites

  1. Make sure the country Curaçao exists in the countries table
    • ISO2 code: CW
    • If it doesn’t exist, run the seeder first: php artisan db:seed --class=CountriesSeeder
  2. Back up the database (recommended but not critical, since we are only adding data):

🚀 Deployment Process

First, run the command in dry-run mode to see which cities would be added:
This will show:
  • Which country was found
  • How many cities already exist
  • Which cities would be added
  • It will NOT make any changes to the database

Step 2: Run in Production

If the dry-run looks good, run the command without the --dry-run flag:
The command will:
  1. Look up the country Curaçao (CW)
  2. Check which cities already exist
  3. Show the cities that will be added
  4. Ask for confirmation before proceeding
  5. Add only the cities that do not exist
  6. Show a summary of what was added

Step 3: Verification

Verify that the cities were added correctly:
Or verify at checkout:
  1. Go to any checkout form
  2. Select the country “Curaçao”
  3. Verify that the cities appear (Willemstad, Bandariba, etc.)

📊 Cities That Are Added

The command adds the following 24 main Curaçao cities:
  1. Willemstad (Capital)
  2. Bandariba
  3. Bandabou
  4. Sint Michiel
  5. St. Michiel
  6. Santa Rosa
  7. Sint Michiel Liber
  8. Brievengat
  9. Barber
  10. Dorp Soto
  11. Otrabanda
  12. Sabana Westpunt
  13. Westpunt
  14. Lagun
  15. Tera Kora
  16. Nieuwpoort
  17. Playa Kanoa
  18. Playa Kalki
  19. Boca San Pedro
  20. Rincon
  21. Dorp Sint Willebrordus
  22. Groot Sint Joris
  23. Sint Joris
  24. Klein Sint Joris

🔄 Running Multiple Times

The command is completely safe to run multiple times. If a city already exists, it will simply be skipped and the command will continue with the rest.

⚠️ Troubleshooting

Error: “Curaçao (CW) not found in countries table”

Solution: Run the countries seeder first:

Database permission error

Solution: Verify that the database user has INSERT permissions on the cities table.

Cities do not appear at checkout

Solution:
  1. Verify that the /api/get-states?country=CW endpoint returns the cities
  2. Clear the cache if necessary: php artisan cache:clear
  3. Verify that the JavaScript code is loading the cities correctly

📝 Additional Notes

  • The CSV cities_202505192231.csv has already been updated with these cities
  • If you run the full cities seeder (CitiesSeeder), these cities will also be included
  • The command uses transactions, so if an error occurs, all changes are automatically rolled back
  • Command: app/Console/Commands/AddWillemstadCity.php
  • CSV: cities_202505192231.csv
  • Model: app/Models/Cities.php
  • API Endpoint: routes/web.php (line 44: /api/get-states)