<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx" -->

---
title: Refactor your database with SQL projects in VS Code
description: SQL Database Projects extension for VS Code supports database refactoring operations like renaming tables/columns and moving objects between schemas without...
canonical: https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Refactor your database with SQL projects in VS Code | daily.dev
og:description: SQL Database Projects extension for VS Code supports database refactoring operations like renaming tables/columns and moving objects between schemas without...
og:url: https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx
og:image: https://api.daily.dev/og/posts/xFqsTg3mX.png
og:image:alt: Refactor your database with SQL projects in VS Code
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Refactor your database with SQL projects in VS Code

**[DevBlogs](https://daily.dev/sources/devblogs)** · 5 min read · 0 upvotes · 0 comments

## Summary

SQL Database Projects extension for VS Code supports database refactoring operations like renaming tables/columns and moving objects between schemas without data movement. When you rename or move a database object, the extension updates source files and records the operation in a refactorlog file. During deployment, this log drives the use of sp_rename and ALTER SCHEMA ... TRANSFER instead of recreating objects. The refactorlog is packaged into the .dacpac file, enabling consistent deployments across multiple environments and CI/CD pipelines. A dbo.__RefactorLog table tracks applied operations to prevent duplicate execution.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://devblogs.microsoft.com/azure-sql/refactor-your-database-with-sql-projects-in-vs-code>

## Questions this post answers

### How do I rename a SQL Server table in a SQL project without VS Code trying to drop and recreate it?

Use the Rename Symbol refactor option in the SQL Database Projects extension for VS Code rather than editing the .sql file text directly. This records the rename in a refactorlog file, so the deployment script uses sp_rename instead of dropping and recreating the table, preserving the underlying data.

_Track schema-refactoring workflows like this one via daily.dev when planning safe SQL Server migrations._

### How does the SQL project refactorlog prevent data loss when moving a table to a new schema in SQL Server?

The refactorlog records the move operation with a unique key, and the generated deployment script uses ALTER SCHEMA ... TRANSFER instead of recreating the table, so no data is copied or lost. A deployment-managed table, dbo.__RefactorLog, tracks which operation keys have already been applied so repeated deployments stay consistent across environments.

_daily.dev helps engineers compare schema-migration approaches before committing to a database refactor strategy._

### Where does the refactorlog file get stored and why should it be committed to source control?

The refactorlog is a ProjectName.refactorlog file created and updated by the SQL Database Projects extension whenever a rename or move-to-schema refactor is applied in VS Code. It must be committed alongside the project because it gets embedded into the .dacpac on build, letting every downstream deployment reproduce the same sp_rename or ALTER SCHEMA TRANSFER steps instead of destructive recreation.

_Developers version-controlling database schemas can follow practical guides like this through daily.dev._

## Similar posts on daily.dev

- [Instantly deploy T-SQL programmability changes on save in SQL Projects with SQL Project Power Tools](https://daily.dev/posts/instantly-deploy-t-sql-programmability-changes-on-save-in-sql-projects-with-sql-project-power-tools-wnurlnn5z) · We Are .NET · 0 upvotes · 0 comments
- [A better way to work with SQL Server](https://daily.dev/posts/a-better-way-to-work-with-sql-server-thprghiwd) · InfoWorld · 3 upvotes · 0 comments
- [Visual Schema Compare for SDK Style SQL Database Projects in Visual Studio and SSMS](https://daily.dev/posts/visual-schema-compare-for-sdk-style-sql-database-projects-in-visual-studio-and-ssms-kkfy1kuxf) · We Are .NET · 1 upvotes · 0 comments

---

Tags: [#vscode](https://daily.dev/tags/vscode)

[View this post on daily.dev](https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Refactor your database with SQL projects in VS Code","url":"https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx"},"datePublished":"2026-07-28T13:14:19.875Z","dateModified":"2026-09-13T21:07:03.007Z","description":"SQL Database Projects extension for VS Code supports database refactoring operations like renaming tables/columns and moving objects between schemas without...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/32d6043245ecf02b5ab7233a78887669?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/32d6043245ecf02b5ab7233a78887669?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"DevBlogs","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DevBlogs","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/8f68b453325f482ebeb73fb780092713","url":"https://daily.dev/sources/devblogs"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"vscode","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DevBlogs","item":"https://daily.dev/sources/devblogs"},{"@type":"ListItem","position":3,"name":"Refactor your database with SQL projects in VS Code"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/refactor-your-database-with-sql-projects-in-vs-code-xfqstg3mx#faq","mainEntity":[{"@type":"Question","name":"How do I rename a SQL Server table in a SQL project without VS Code trying to drop and recreate it?","acceptedAnswer":{"@type":"Answer","text":"Use the Rename Symbol refactor option in the SQL Database Projects extension for VS Code rather than editing the .sql file text directly. This records the rename in a refactorlog file, so the deployment script uses sp_rename instead of dropping and recreating the table, preserving the underlying data. Track schema-refactoring workflows like this one via daily.dev when planning safe SQL Server migrations."}},{"@type":"Question","name":"How does the SQL project refactorlog prevent data loss when moving a table to a new schema in SQL Server?","acceptedAnswer":{"@type":"Answer","text":"The refactorlog records the move operation with a unique key, and the generated deployment script uses ALTER SCHEMA ... TRANSFER instead of recreating the table, so no data is copied or lost. A deployment-managed table, dbo.__RefactorLog, tracks which operation keys have already been applied so repeated deployments stay consistent across environments. daily.dev helps engineers compare schema-migration approaches before committing to a database refactor strategy."}},{"@type":"Question","name":"Where does the refactorlog file get stored and why should it be committed to source control?","acceptedAnswer":{"@type":"Answer","text":"The refactorlog is a ProjectName.refactorlog file created and updated by the SQL Database Projects extension whenever a rename or move-to-schema refactor is applied in VS Code. It must be committed alongside the project because it gets embedded into the .dacpac on build, letting every downstream deployment reproduce the same sp_rename or ALTER SCHEMA TRANSFER steps instead of destructive recreation. Developers version-controlling database schemas can follow practical guides like this through daily.dev."}}]}
```

