<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Malik Samad Khan</title>
    <description>The latest articles on Forem by Malik Samad Khan (@maliksamad).</description>
    <link>https://forem.com/maliksamad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1226223%2F57e0c1f8-5342-4634-b3f3-f406bd4568a0.jpeg</url>
      <title>Forem: Malik Samad Khan</title>
      <link>https://forem.com/maliksamad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/maliksamad"/>
    <language>en</language>
    <item>
      <title>Sequelize CLI &amp; Typescript</title>
      <dc:creator>Malik Samad Khan</dc:creator>
      <pubDate>Thu, 14 Dec 2023 04:51:58 +0000</pubDate>
      <link>https://forem.com/maliksamad/sequelize-cli-typescript-4ff0</link>
      <guid>https://forem.com/maliksamad/sequelize-cli-typescript-4ff0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Sequelize is specifically built for javascript projects and has no official documentation on how to use it in typescript as you would normally do in javascript.&lt;/p&gt;

&lt;p&gt;In this post, I will explain how I do the configuration for Sequelize in a typescript project which works for production uses specifically for running migrations cli. Sequelize by default uses javascript for its cli commands and we need to make it compatible with a typescript project.&lt;/p&gt;

&lt;h4&gt;
  
  
  Note:
&lt;/h4&gt;

&lt;p&gt;Most of the online blogs/posts on this topic don't show how you can configure for running migration and instead show you the implementation by using &lt;code&gt;connection.sync()&lt;/code&gt; method, which is not an option for your production environment. check the official documentation for the sync method &lt;a href="https://sequelize.org/docs/v6/core-concepts/model-basics/#synchronization-in-production" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requesites
&lt;/h2&gt;

&lt;p&gt;Before we start the configuration, it is needed to have Node installed on your machine. also for npm package management, I usually prefer &lt;code&gt;yarn&lt;/code&gt; but you can use &lt;code&gt;npm&lt;/code&gt; for this as well.&lt;/p&gt;

&lt;p&gt;I will be using MySQL for the database using the docker container, and for viewing the database I am using MySQL Workbench.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository Link
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/malik-samad/sequelize-with-typscript" rel="noopener noreferrer"&gt;https://github.com/malik-samad/sequelize-with-typscript&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional - Creating Database using Docker
&lt;/h2&gt;

&lt;p&gt;I prefer to create databases using docker container which I feel is a more clean way of doing it. For this purpose, we will use &lt;code&gt;docker-compose.yml&lt;/code&gt; file in the project's root directory.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3'
name: sequelize-with-typescript
services:
  local-sql-db:
    image: mysql:latest
    container_name: local-sql-db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: sql-ts-local
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    ports:
      - '3306:3306'
    volumes:
      - mysql-data:/var/lib/mysql # Change this path as per your preference

volumes:
  mysql-data:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;now you should be able to spin up your DB using &lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To view the database you can add a connection in your SQL Workbench as per the credentials defined in the &lt;code&gt;docker-compose.yml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fun0rzxiufabjt0h7mtfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fun0rzxiufabjt0h7mtfu.png" alt="SQL-Workbench connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Instalation
&lt;/h2&gt;

&lt;p&gt;Let's start creating a basic express server with Sequelize and Typescript. First of all, create a folder for the project, and then navigate into it.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir sequlize-with-typescript
cd sequlize-with-typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then, install the necessary packages.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn init -y
yarn add express node sequelize sequelize-cli mysql2 dotenv
yarn add typescript ts-node @types/express @types/node @types/sequelize nodemon --dev 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Configure Typescript
&lt;/h2&gt;

&lt;p&gt;For a typescript-based project, we need to have a &lt;code&gt;tsconfig.json&lt;/code&gt; file in the root directory, which contains configuration related to typescript. For this project, we will use the below config.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "compilerOptions": {
    "allowJs": true,
    "baseUrl": "./src",
    "allowUnreachableCode": false,
    "noFallthroughCasesInSwitch": true,
    "allowSyntheticDefaultImports": true,
    "downlevelIteration": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "module": "Node16",
    "noImplicitAny": true,
    "resolveJsonModule": true,
    "noImplicitReturns": false,
    "noImplicitThis": true,
    "noUnusedLocals": false,
    "sourceMap": true,
    "strictNullChecks": true,
    "strict": true,
    "pretty": true,
    "target": "es6",
    "typeRoots": ["./src/typings", "../../node_modules/@types"],
    "outDir": "build"
  },
  "include": ["./**/*.ts"],
  "exclude": ["node_modules", "build", "dist"]
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;please refer to the &lt;a href="https://www.typescriptlang.org/docs/handbook/tsconfig-json.html" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; for more details on how to tweak tsconfig file as per your need. you can also start with &lt;code&gt;npx tsc --init&lt;/code&gt; which will create a basic tsconfig including almost all possible options with commented-out details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure Sequelize
&lt;/h2&gt;

&lt;p&gt;To configure Sequelize we need to first create a config file named &lt;code&gt;.sequelizerc&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// .sequelizerc
const path = require('path');

module.exports = {
  config: path.resolve('src/database', 'sequelize.config.js'),
  'models-path': path.resolve('src/database', 'models'),
  'seeders-path': path.resolve('src/database', 'seeders'),
  'migrations-path': path.resolve('src/database', 'migrations'),
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let's run &lt;code&gt;npx sequelize init&lt;/code&gt;, this will create a directory under &lt;code&gt;src/database&lt;/code&gt; which will contain sub-folders for &lt;code&gt;models&lt;/code&gt;, &lt;code&gt;migrations&lt;/code&gt;, and &lt;code&gt;seeds&lt;/code&gt;. additionally, it will also contain &lt;code&gt;sequelize.config.js&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;we will need to replace the content of &lt;code&gt;sequelize.config.js&lt;/code&gt; with below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/database/sequelize.config.js
require('ts-node/register');
const configs = require('../configs.ts');

module.exports = {
  username: configs.DB_USERNAME,
  password: configs.DB_PASSWORD,
  database: configs.DB_DATABASE,
  host: configs.DB_HOST,
  dialect: 'mysql',
  port: 3306
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It is important to keep &lt;code&gt;require('ts-node/register');&lt;/code&gt; on the first line, this will make sure that Sequelize cli understands typescript when running migrations or seedings.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;sequelize.config.js&lt;/code&gt; file we are using runtime envs for the sequelize cli, using the same config file that we will be using inside the express server.&lt;/p&gt;

&lt;p&gt;Now we need to update the package.json to have some scripts for running the server and migrations, below are the needed scripts:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  ...
  "scripts": {
    "start": "ts-node src/index.ts",
    "db:up": "docker-compose up -d",
    "db:create": "sequelize db:create",
    "db:migrate": "sequelize db:migrate",
    ...
  },
  ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Creating migration files
&lt;/h2&gt;

&lt;p&gt;To create migration files, we will create 2 models named &lt;code&gt;users&lt;/code&gt; and &lt;code&gt;todos&lt;/code&gt; using sequelize cli.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx sequelize-cli model:generate --name Todos --attributes title:string,isDone:boolean

npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string,password:string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;this will create 2 files &lt;code&gt;**********-create-user.js&lt;/code&gt; and &lt;code&gt;**********-create-todos.js&lt;/code&gt;, as you can see these files are not typescript but instead javascript files. &lt;/p&gt;

&lt;p&gt;Sequelize will not create a ts file by default and that's why our next step will be to rename the file and make it a &lt;code&gt;.ts&lt;/code&gt; file. additionally, we will also need to add some typing to remove errors reported by typescript on the file. &lt;/p&gt;

&lt;p&gt;after doing these changes these 2 migration files will be as below:&lt;br&gt;
&lt;code&gt;src/database/migrations/**********-create-user.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { QueryInterface, DataTypes } from 'sequelize';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface: QueryInterface, Sequelize:typeof DataTypes) {
    await queryInterface.createTable('Users', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      firstName: {
        type: Sequelize.STRING
      },
      lastName: {
        type: Sequelize.STRING
      },
      email: {
        type: Sequelize.STRING
      },
      password: {
        type: Sequelize.STRING
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface:QueryInterface, Sequelize:any) {
    await queryInterface.dropTable('Users');
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;src/database/migrations/**********-create-todos.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { QueryInterface, DataTypes } from 'sequelize';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface: QueryInterface, Sequelize:typeof DataTypes) { 
    await queryInterface.createTable('Todos', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      title: {
        type: Sequelize.STRING
      },
      isDone: {
        type: Sequelize.BOOLEAN
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
    await queryInterface.addColumn(
      'Todos', // name of Source model
      'user_id', // name of the key we're adding 
      { 
        type: Sequelize.INTEGER ,
        references: {
          model: 'Users', // name of Target model
          key: 'id', // key in Target model that we're referencing
        },
        onUpdate: 'CASCADE',
        onDelete: 'SET NULL',
      }
    )
  },
  async down(queryInterface:QueryInterface, Sequelize:any) {
    await queryInterface.dropTable('Todos');
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Sequelize Models
&lt;/h2&gt;

&lt;p&gt;we need to make some changes in the model files to make them work properly in a typescript project.&lt;br&gt;
First of all, we will have to change the file's extensions from &lt;code&gt;.js&lt;/code&gt; to &lt;code&gt;.ts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now the content for models should be changed as shown below:&lt;br&gt;
for &lt;code&gt;src/databse/models/users.ts&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Model, DataTypes } from 'sequelize';
import connection from '../connection';
import Todo from './todos';

interface UserAttributes {
  id?: number;
  firstName: string;
  lastName: string;
  email: string;
  password: string;

  updatedAt?: Date;
  deletedAt?: Date;
  createdAt?: Date;
}

class User extends Model&amp;lt;UserAttributes&amp;gt; implements UserAttributes {
  public id!: number;
  public firstName!: string;
  public lastName!: string;
  public email!: string;
  public password!: string;

  public readonly updatedAt!: Date;
  public readonly createdAt!: Date;
}

User.init(
  {
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.NUMBER,
    },
    firstName: {
      allowNull: false,
      type: DataTypes.STRING,
    },
    lastName: {
      allowNull: false,
      type: DataTypes.STRING,
    },
    email: {
      allowNull: false,
      unique: true,
      type: DataTypes.STRING,
    },
    password: {
      allowNull: false,
      type: DataTypes.STRING,
    }, 

    createdAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
    updatedAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
  },
  {
    sequelize: connection,
    modelName: 'User',
  }
);

export default User;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and for &lt;code&gt;src/databse/models/todos.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Model, DataTypes } from 'sequelize';
import connection from '../connection';
import User from './user';

interface TodoAttributes{

  id?: number;
  title: string;
  user_id:number;
  isDone: boolean;

  updatedAt?: Date;
  deletedAt?: Date;
  createdAt?: Date;
}

class Todo extends Model&amp;lt;TodoAttributes&amp;gt; implements TodoAttributes {
  public id!: number;
  public title!: string;
  public user_id!:number;
  public isDone!: boolean;

  public readonly updatedAt!: Date;
  public readonly createdAt!: Date;
}

Todo.init(
  {
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.NUMBER,
    }, 
    title: {
      allowNull: false,
      type: DataTypes.STRING,
    },
    isDone: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    },
    user_id:{
      type: DataTypes.NUMBER,
      allowNull:false
    },

    createdAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
    updatedAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
  },
  {
    sequelize: connection,
    modelName: 'Todo',
  }
);

// associate
Todo.belongsTo(User, {
  as: 'user',
  foreignKey: {
    name: 'user_id',
    allowNull: false,
  },
  foreignKeyConstraint: true,
});

export default Todo;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To demonstrate an association between the 2 models, I have associated todo with the user by using the &lt;code&gt;belongsTo&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;As you may already noticed, we are using a connection inside the model file. this connection file is defined in &lt;code&gt;src/database&lt;/code&gt; directory:&lt;br&gt;
&lt;code&gt;src/database/connection.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Sequelize } from 'sequelize';
import { DB_DATABASE, DB_HOST, DB_PASSWORD, DB_USERNAME } from '../configs';

let sequelizeConnection: Sequelize = new Sequelize(DB_DATABASE, DB_USERNAME, DB_PASSWORD, {
  host: DB_HOST,
  dialect: 'mysql',
  port: 3306, 
});

export default sequelizeConnection;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, to test these models and Sequelize, let's create a simple basic express server with GET Api as shown below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/index.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { PORT } from "./configs";
import Express from "express";
import Todo from "./database/models/todos";
import User from "./database/models/user";

const server = Express();

server.get("/todo/all", async (req, res) =&amp;gt; {
  try{
    res.send(await Todo.findAll({
      include: [{model: User, as: "user"}]
    }))
  }catch(err){
    console.error(err);
    res.status(500).send("Unexpected error occurred on server!");
  }
})

const port = PORT || 80;
server.listen(port, () =&amp;gt; {
  console.log(`🚀 Server is running on port ${port}`)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Ok, at this point we have everything ready to test and run, to do this let's open the terminal for your project root directory we will run cli to create MySQL Container, create DB, and run migrations.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn db:up
yarn db:create
yarn db:migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, let's spin up the express server using the below cli&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and open the GET endpoint &lt;a href="http://localhost/todo/all" rel="noopener noreferrer"&gt;http://localhost/todo/all&lt;/a&gt; in the browser, you should see a response like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskl8zes4hu6bps07qc1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskl8zes4hu6bps07qc1q.png" alt="API response in browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To add some test data&lt;/strong&gt;, open your DB and add dummy data using below MySQL scripts&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&lt;code&gt;INSERT INTO&lt;/code&gt;sequelize-with-typescript&lt;code&gt;.&lt;/code&gt;Users&lt;code&gt;(&lt;/code&gt;firstName&lt;code&gt;,&lt;/code&gt;lastName&lt;code&gt;,&lt;/code&gt;email&lt;code&gt;,&lt;/code&gt;password&lt;code&gt;,&lt;/code&gt;createdAt&lt;code&gt;,&lt;/code&gt;updatedAt&lt;code&gt;) VALUES ('Malik', 'Samad', 'test@email.com', 'secure pass', '2023-12-05 00:00:00', '2023-12-05 00:00:00');&lt;/code&gt;

&lt;p&gt;&lt;code&gt;INSERT INTO&lt;/code&gt;sequelize-with-typescript&lt;code&gt;.&lt;/code&gt;Todos&lt;code&gt;(&lt;/code&gt;title&lt;code&gt;,&lt;/code&gt;user_id&lt;code&gt;,&lt;/code&gt;isDone&lt;code&gt;,&lt;/code&gt;createdAt&lt;code&gt;,&lt;/code&gt;updatedAt&lt;code&gt;) VALUES ('test todo 1', '1', '0', '2023-12-05 00:00:00', '2023-12-05 00:00:00');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;INSERT INTO&lt;/code&gt;sequelize-with-typescript&lt;code&gt;.&lt;/code&gt;Todos&lt;code&gt;(&lt;/code&gt;title&lt;code&gt;,&lt;/code&gt;user_id&lt;code&gt;,&lt;/code&gt;isDone&lt;code&gt;,&lt;/code&gt;createdAt&lt;code&gt;,&lt;/code&gt;updatedAt&lt;code&gt;) VALUES ('test todo 2', '1', '0', '2023-12-07 00:00:00', '2023-12-07 00:00:00');&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;This blog provides a comprehensive guide on configuring and using Sequelize with TypeScript for building robust and maintainable‎ APIs. here we have covered the configuration needed for running migration cli in your typescript project for the production environment.&lt;/p&gt;

&lt;p&gt;additionally, we have also covered fundamentals of Sequelize cli, migrations, associations, and models.&lt;/p&gt;

</description>
      <category>sequelize</category>
      <category>typescript</category>
      <category>express</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
