Using Sequelize with Postgres — Part 1 | by ScruffyStudios | Coinmonks

You will need:
-Node JS

If you haven’t got postgres installed go do that — !

Using node make your project directory then install.

Once installed run.

Let’s make our model.

Using Sequelize we can connect to our Postgres server, create our database, migrate our models into the DB as tables.

Your config file should look like this.

Whenever you just interact with your model in your code it will by default choose development. Set your postgres username, password, database name, host IP & the dialect to ‘postgres’.

Note that the database does not exist in the postgres server at this point.

Save the file.

Aslong as you have done that correctly you can now run the following command.

Let’s make one more model before migrating our models.

Now let’s check first in postgres that our DB exists

Okay so it’s there.
Connect to your DB.

List any tables.

Let’s migrate our models.

Let’s check for tables in our DB again.

If you found this interesting then do check this out!

Solidity Dev Study Group —

-Polygon Alliance —

-Polygon Alliance Discord —

Did you enjoy this article?
Feel like buying me a cup of coffee?
Polygon/Eth/Bsc — 0x4A581E0eaf6b71D05905e8E6014dc0277A1B10ad

New to trading? Try crypto trading bots or copy trading on best crypto exchanges

Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News

  • Free Crypto Signals | Crypto Trading Bots
  • An ultimate guide to Leveraged Token
  • 16 Best Folding Electric Bikes
  • 28 Best Electric Bikes Review
  • Top 3 Binance Futures Trading Bots

#Sequelize #Postgres #Part #ScruffyStudios #Coinmonks

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: