TypeORM: Property ‘id’ has no initializer and is not definitely assigned in the constructor
When defining entities with TypeORM and TypeScript, you may encounter an annoying issue as follows: The warnings are present not only in the id field but also in all other fields in my classes entity: The…
TypeORM: Adding created_at and updated_at columns
In TypeORM, you can add a created_at column and a updated_at column by making use of the CreateDateColumn and UpdateDateColumn decorators, respectively. These columns will be automatically initialized and updated to the current date and time…
Unsigned (non-negative) Integer in PostgreSQL
In PostgreSQL, you can add a constraint that enforces a column to have only non-negative integers by using the CHECK keyword. Example A product can have a price greater or equal to 0 (e.g. a free…
2 Ways to Rename a Table in PostgreSQL
This short article shows you 2 different ways to rename a table in a PostgreSQL database. The first approach is to execute the ALTER TABLE statement with the RENAME keyword and the second one is to…
2 Ways to Get the Size of a Database in PostgreSQL
You can see the size of a whole PostgreSQL database by using the pg_database_size() function or via pgAmin. Using pg_database_size() Login to your Postgres server by using the psql command then execute the following statement: Don’t…
2 ways to rename a database in PostgreSQL
This concise article shows you 2 different ways to change the name of a certain database in PostgreSQL. The first method is using the command line and the second one is via pgAdmin. Using Command Line…
How to select a Database to use in PostgreSQL
This short article shows you 2 different ways to select a database in PostgreSQL (in MySQL, there is the command use database <database name> but such thing doesn’t exist in the PostgreSQL world). Using psql You…
2 Ways to Show all Databases in PostgreSQL
This concise and straightforward article walks you through a couple of different ways to view all databases (on your server) in PostgreSQL. Using psql command The quick way Open a terminal window on your computer then…
PostgreSQL: Create Tables with Auto-Increment IDs
This article walks you through 2 different approaches to creating tables with auto-generated primary keys in PostgreSQL. Without any further ado, let’s get in action. Using generated as identity This syntax is available from PostgreSQL 10…
How to Create/Delete a Database with MongoDB Shell
This short post demonstrates how to create and drop a MongoDB database by using the command line. Creating a New Database The “use [your database name]” command will create a new database if it doesn’t exist,…
How to Check MongoDB Version on Windows, Mac, and Linux
You can see the version of MongoDB installed on your computer or server by using the following command: Here’s the result I get on my Mac after executing the mentioned command: And this’s the output I…
MongoDB: Renaming a Database with Command Line
This short post shows you how to change the name of a MongoDB database by using the command line (MongoDB shell). At this time, there are no official out-of-the-box tools from the MongoDB team that can…
« Previous 1 2 3 Next »