Skip to content

Instantly share code, notes, and snippets.

@tgaff
Created January 17, 2020 20:14
Show Gist options
  • Save tgaff/ca7a053fbab66fa85b6b1ace30b213b7 to your computer and use it in GitHub Desktop.
Save tgaff/ca7a053fbab66fa85b6b1ace30b213b7 to your computer and use it in GitHub Desktop.
Update elasticbeanstalk eb db url with utf8mb4 encoding and utf8mb4_unicode_ci collation - requires manual string edit!
#!/bin/bash
set +e
eb use $1
echo $1
eb printenv | grep DATABASE_URL
URL=`eb printenv | grep DATABASE_URL | sed -e 's/^[ \t]*//'`
echo "Using the above URL"
echo " you need to add '?encoding=utf8mb4&collation=utf8mb4_unicode_ci' to the end and format the params properly if others are already there"
echo " Then run eb setenv \"DATABASE_URL=<the-new-url>\""
echo
echo
echo "Template:"
echo "eb setenv \"${URL} + ?encoding=utf8mb4&collation=utf8mb4_unicode_ci\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment