I was so very excited to finally publish my apps; I registered with Heroku, and jumped right into it! My first experience with Heroku made me smile from ear to ear! The entire process took a total of 3 minutes. Choose a site name that starts with a lower case letter, no special characters, connect it to your existing GitHub repo, allow automatic updates, and tada, your cooking with grease! The second or third app I attempted to publish informed me that Sqlite is not an accepted database management system for Heroku deployments. No problem; I already had Postgres on my computer. I just used SQLite3 because that was the default database for rails applications.
Even though I knew that generally, it is not the best practice to just fiddle around I started reading suggestions on how to change an existing application's database from SQL to Postgresql. It was so very frustrating I decided to, succinctly as possible, detail one way to switch from SQL to Postgresql.
(Before I begin, I am of the mindset that if you are not 100 assured of the correct path to take, it is not at all a step backward to start the app from scratch just to get the database connected to your frontend and then copy and paste the meat and potatoes from your working app into the new version of your app.)
Okay, the first thing I want to point out is don’t worry about all the bells and whistles. Postgres does a smashing good job just the way it is packaged. For all intents and purposes just click the “okay” button three times and let the download begin. You may need to sit through the stack builder installations more than once, but that is not going to hurt anything. Next, in PgAdmin, when you set up your account, the server by default is ‘localhost’. the username is ‘postgres’, and the default database is ‘postgres’. (I may be wrong about that default values but, look at the wording of the prompts because the prompts are phrased very similarly). You can change the password and answers once you get more familiar with Postgres but, this will keep things simple.
After you create a database, create a new user/role (don’t forget to allow your new user all of the options in the “privileges” tab so that you can connect to the database from VScode). Once your new database is active, you may think you want to test the new database connection in the Ubuntu terminal right away by running “psql -p 5432 -h localhost -U postgres” but, DON’T DO IT YET, lol! You need to run two more commands before you can crack a smile.
run ‘sudo apt install postgresql-client-common’, and ‘’sudo apt-get install postgresql-client’ in the Ubuntu terminal.
When the installations are complete, THEN, you can crack a smile. You don’t even need to close out the terminal before testing your connection.
On a side note, you can just as easily (once your setup in the Postgres application is completed) jump right into VSCode first. There are two extensions you should install. The Heroku-CLI extension, and an extension called Postgres (the version I installed was 0.3.0). The reason I suggest installing the Heroku CLI now is that you will see it suggested approximately 293 more times when you get ready to deploy your app if you choose to use Heroku, and VS Code has taken care of all the worrying for you.
The last thing, when you're setting up the connection to your database in VSCode, the Postgres extension will ask for your PgAdmin credentials. That is why having a straightforward, or even repetitive pattern is not such a bad idea until you know what to expect, ie: “I want to connect to the postgres database on the Postgres server. my username is postgres (and whatever password you chose).
The End. You should be ready to make tables, and apps, and all things beautiful.