+965 9727 1175 info@a1-soft.com
AR | EN | FR

Every capability

Detailed list of what A1 Data Migrator handles automatically and what it surfaces for you to decide on.

Type mapping (T-SQL → PostgreSQL)

SQL ServerPostgreSQLNotes
int / bigint / smallintinteger / bigint / smallintdirect
tinyintsmallintPG has no tinyint
bitbooleandefaults 0/1false/true
decimal(p,s) / moneynumeric(p,s) / numeric(19,4)direct
nvarchar(n) / nvarchar(max)varchar(n) / textbyte halving for nvarchar
datetime / datetime2 / datetimeoffsettimestamp(3) / timestamp(6) / timestamptzprecision preserved
uniqueidentifieruuidrequires pgcrypto
varbinary / imagebyteadirect
IDENTITY(1,1)GENERATED BY DEFAULT AS IDENTITYseed + step preserved; sequences reset to MAX(id) after copy

Default expression conversion

SQL Server defaultPostgreSQL output
GETDATE() / SYSDATETIME()now()
GETUTCDATE() / SYSUTCDATETIME()(now() at time zone 'utc')
NEWID()gen_random_uuid()
SUSER_SNAME()current_user
DB_NAME() / HOST_NAME()current_database() / inet_client_addr()::text
CONVERT([date], expr)CAST(expr AS date)
'X'+expr on string columns'X' || expr
DEFAULT 0 on datetimeTIMESTAMP '1900-01-01 00:00:00'

Smart constraint fallback

When a btree index hits the 2,704-byte row limit, the runner reacts:

Index shapeWhat happens
1 column, non-unique, no INCLUDEAuto-retry as USING HASH
Multi-column or has INCLUDELogged to {db}_constraints_report.sql — DBA decides (md5 expr, partial WHERE, GIN trigram)
UNIQUE oversizedLogged with a warning — hash would risk collisions
FK violated by source data (orphan rows)Logged with the data-cleanup options inline
CHECK violated by source dataLogged; suggested NOT VALID rewrite

Unported objects inventory

Triggers, stored procedures, views, scalar/table-valued functions are not auto-rewritten (T-SQL → PL/pgSQL is too lossy). Instead:

  • ✓ Captured into _migration_meta.objects on the target — queryable, filterable
  • ✓ Original T-SQL preserved verbatim in tsql_definition
  • ✓ Companion workbook file {db}_unconverted_objects.sql with PostgreSQL stubs above each block
  • port_status column to track progress: PENDING / IN_PROGRESS / DONE / IGNORED
  • ✓ View _migration_meta.unported shows what's left

CLI commands

a1mig inspect       Read source schema and print a summary report.
a1mig convert       Generate the PostgreSQL DDL script (writes to file).
a1mig schema        Phase 1: drop+create target DB and apply tables (no idx/FK).
a1mig data          Phase 2: copy rows (binary COPY, deferred FKs).
a1mig constraints   Phase 3: indexes + FKs + check constraints (smart fallback).
a1mig objects       Phase 4: capture triggers/procs/views/functions into
                    _migration_meta.objects + write porting workbook.
a1mig full          Run all phases in order, then verify.
a1mig verify        Compare row counts between source and target tables.

كل المزايا

قائمة تفصيلية بكل ما يعالجه A1 Data Migrator تلقائياً وما يُظهره لك للقرار.

تحويل الأنواع (T-SQL → PostgreSQL)

SQL ServerPostgreSQLملاحظات
int / bigint / smallintinteger / bigint / smallintمباشر
tinyintsmallintلا يوجد tinyint في PG
bitbooleanالـ defaults 0/1false/true
decimal(p,s) / moneynumeric(p,s) / numeric(19,4)مباشر
nvarchar(n) / nvarchar(max)varchar(n) / textbyte halving للـ nvarchar
datetime / datetime2 / datetimeoffsettimestamp(3) / timestamp(6) / timestamptzيُحافَظ على الـ precision
uniqueidentifieruuidيتطلب pgcrypto
IDENTITY(1,1)GENERATED BY DEFAULT AS IDENTITYيُحافَظ على seed + step؛ تُعاد الـ sequences إلى MAX(id) بعد النقل

Smart fallback للـ constraints

عندما يتجاوز btree index حدّ الـ 2704 بايت، يتصرّف الـ runner كالآتي:

شكل الـ indexما يحدث
عمود واحد، non-unique، بدون INCLUDEإعادة محاولة تلقائية باستخدام USING HASH
multi-column أو يحتوي على INCLUDEيُسجَّل في {db}_constraints_report.sql — ليقرّر الـ DBA
UNIQUE كبير الحجميُسجَّل مع تحذير — لأن hash قد يؤدي إلى collisions
FK تخالفه بيانات الـ source (orphan rows)يُسجَّل مع خيارات تنظيف البيانات
CHECK تخالفه البياناتيُسجَّل؛ مع اقتراح إعادة الكتابة بـ NOT VALID