Postgres

Should You Add a Column to your Database

Think twice, there's a reason to

Andy Huynh

2 minute read

There’s columns you’ll want to query from your database. However, third party integrations (like Stripe or PayPal), in particular, might urge you NOT to add a column to your database, depending on your setup. Let’s state the obvious: a basic User class will most likely have an email column. You’ll be querying this often as a SaaS for customers. A database column makes complete sense is common sense. A good rule of thumb to add a database column when working with third parties is if you’ll be querying them often.

PG::ObjectInUse: ERROR - Let's fix this

Three options I use to move past this bitch

Andy Huynh

1 minute read

Here’s why and how you fix this error: PG::ObjectInUse: ERROR: database "<MY_DATABASE>" is being accessed by other users DETAIL: There are 4 other sessions using the database. : DROP DATABASE IF EXISTS "<MY_DATABASE>" You can have a console open in a shell, your server running, another console open and maybe try opening another Rails app in a Tmux session. You’re spinning multiple Ruby processes and Postgres isn’t down with it. You can’t perform normal tasks like rake db:drop or migrate because you have active connections to your Postgres database.