-
Notifications
You must be signed in to change notification settings - Fork 945
Open
Milestone
Description
Version: 1.48.0-insider (user setup)
Commit: 8a715ed
Date: 2024-02-15T12:58:00.069Z
VS Code: 1.82.0
Electron: 25.9.8
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22631
Scenario 1
- Create a database with this:
CREATE SCHEMA [Apps]
GO
CREATE TABLE [Apps].[Apps] ([Col1] INT NULL)
GO
- Create a new blank database project
- Update project from database
- Select "Flat" for folder structure"
- In the Schema Compare window that opens, both the schema and table show up correctly. But if you click "Apply", on the schema is added to the sqlproj as Apps.sql
- If we run schema compare again, the table now shows as a difference because it wasn't added the first time
- If you hit "Apply" again, the Apps.sql with the schema is overwritten with the table script and build fails because now it can't find the schema.
SQL71501: SqlTable: [Apps].[Apps] has an unresolved reference to SqlSchema [Apps].
Scenario 2
- Create a database with this:
CREATE LOGIN [Apps] WITH PASSWORD = '***'
GO
CREATE USER [Apps] FOR LOGIN [Apps] WITH DEFAULT_SCHEMA = [Apps]
GO
CREATE SCHEMA [Apps] AUTHORIZATION [Apps]
GO
- Create a new database project, add only the login to it:
CREATE LOGIN [Apps] WITH PASSWORD = '***'
- Update project from database. This time it doesn't matter which folder structure you choose, both the user and the schema ends up in the same folder. If you apply changes, only the schema is created, and you get a build error
SQL71501: SqlSchema: [Apps] has an unresolved reference to object [Apps].
- If you schema compare again, the User shows up as a change because it wasn't added the first time. Applying this change results in the schema Apps being overwritten by the user, and we get a new build error
SQL71502: SqlUser: [Apps] has an unresolved reference to SqlSchema [Apps].