Connect Microsoft SQL Server

Reverse Migrations only needs to read schema metadata - tables, columns, data types, constraints, and indexes. It never reads the actual rows in your tables.

The steps below create a dedicated login that can inspect the schema but cannot SELECT from user tables.

1. Create the server login

Connect to the master database as an administrator (for example a member of the sysadmin role) and run:

SQL · Microsoft SQL Server
CREATE LOGIN reverse_migrations WITH PASSWORD = 'Test-Service-Account-42!';

Replace the example password with a strong, unique password that meets your server's password policy. The example includes uppercase and lowercase letters, numbers, and symbols so it satisfies SQL Server's default complexity requirements.

2. Create the database user and grant metadata permissions

For each database you want to introspect, run:

SQL · Microsoft SQL Server
USE [your_database];
CREATE USER reverse_migrations FOR LOGIN reverse_migrations;
 
-- Allow connection to the database
GRANT CONNECT TO reverse_migrations;
 
-- Allow reading object definitions (schema metadata) without table data access
GRANT VIEW DEFINITION TO reverse_migrations;

If you also want the account to be able to list all databases on the instance, run this once in master:

SQL · Microsoft SQL Server
USE [master];
GRANT VIEW ANY DATABASE TO reverse_migrations;

3. Verify the user cannot read table data

Connect as reverse_migrations and try to query a user table. It should fail:

SQL · Microsoft SQL Server
SELECT * FROM your_database.dbo.some_user_table;
-- Msg 229, Level 14, State 5: The SELECT permission was denied on the object 'some_user_table'

Schema queries should succeed:

SQL · Microsoft SQL Server
SELECT * FROM your_database.sys.tables;
SELECT * FROM your_database.INFORMATION_SCHEMA.TABLES;

4. Use this credential in the dashboard

Copy the username (reverse_migrations) and password into the workspace when you select Add database and choose Microsoft SQL Server.

References

Documentation - Reverse Migrations