sqlserver-to-postgres-migration

Migrates SQL Server schemas, T-SQL, and data to PostgreSQL on Azure.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/samdop/convertonode --skill sqlserver-to-postgres-migration-samdop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlserver-to-postgres-migration
Source: https://github.com/samdop/convertonode/tree/main/.github/skills/sqlserver-to-postgres-migration
Command: npx skills add https://github.com/samdop/convertonode --skill sqlserver-to-postgres-migration-samdop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Migrating an ASP.NET MVC application's database from SQL Server to PostgreSQL requires translating DDL, T-SQL queries, stored procedures, and data types, then moving data reliably and wiring the Node.js API to Azure Database for PostgreSQL. This Skill provides the complete runbook for that migration path. ## Core Features & Use Cases - Schema and Type Translation: Maps SQL Server types (IDENTITY, uniqueidentifier, nvarchar, datetime2, money, rowversion) to PostgreSQL equivalents with rules for constraints, indexes, and extensions like pgcrypto and PostGIS. - T-SQL and Stored Procedure Conversion: Converts T-SQL syntax to PL/pgSQL and guides the decision between moving procedures to the Node service layer, rewriting them as PL/pgSQL functions, or keeping batch logic in PostgreSQL. - Data Migration and ORM Setup: Runs repeatable pgloader data loads with verification checklists and rollback strategy, and sets up Prisma, Drizzle, TypeORM, or node-pg-migrate with Entra ID managed identity authentication. - Use Case: During Phase 3 of an ASP.NET MVC to Node.js + React migration, translate EF Core migrations and stored procedures into a Prisma schema, load data with pgloader into Azure Database for PostgreSQL Flexible Server, and verify row counts and constraints before cutover. ## Quick Start Ask the assistant to migrate your SQL Server database schema and stored procedures to PostgreSQL using Prisma and pgloader for the Node.js API.

Frequently Asked Questions about sqlserver-to-postgres-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate SQL Server data to PostgreSQL?

Use pgloader as the default tool: write a load script with source and target connection strings, define type casts for nvarchar, datetime, bit, and uniqueidentifier, then run it via Docker or a native install. Verify row counts, sequences, and constraints afterward, and use Azure Database Migration Service for large or low-downtime enterprise cutovers.

Prisma vs Drizzle vs TypeORM for PostgreSQL in Node.js?

Prisma is the default for schema-first DX with a generated typed client. Drizzle fits SQL-first TypeScript teams wanting a light runtime, TypeORM suits teams coming from EF Core who want decorators and entities, and node-pg-migrate with raw pg fits teams porting heavy T-SQL who want full SQL control.

How do I convert SQL Server stored procedures to PostgreSQL?

Decide by procedure type: move thin CRUD and business workflow procedures into the Node service layer, translate set-heavy stable logic into PL/pgSQL functions with CREATE OR REPLACE FUNCTION, and keep performance-critical batch logic in PostgreSQL called through a thin repository. Replace OUT parameters with RETURNS TABLE where result sets are needed.

What is the PostgreSQL equivalent of SQL Server IDENTITY and uniqueidentifier?

Map INT IDENTITY to INTEGER GENERATED ALWAYS AS IDENTITY and BIGINT IDENTITY to BIGINT GENERATED ALWAYS AS IDENTITY. Map uniqueidentifier to uuid with a default of gen_random_uuid(), which requires enabling the pgcrypto extension.

Can I connect a Node.js API to Azure PostgreSQL without a password?

Yes. Azure Database for PostgreSQL Flexible Server supports Microsoft Entra authentication. Acquire a token with DefaultAzureCredential for the ossrdbms-aad scope and pass it as the database password in pg or a Prisma DATABASE_URL, refreshing the token before expiry.

When should I not use this PostgreSQL migration workflow?

Skip it when the migration assessment decided to keep SQL Server. In that branch, use the Node mssql package (built on tedious) with managed identity, keep secrets in Azure Key Vault, and skip pgloader, type mapping, and PL/pgSQL translation entirely.