Skip to content

Commit

Permalink
Add proper .dacpac project (#2740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ authored Dec 17, 2024
1 parent 41ad1cf commit 9f47edf
Show file tree
Hide file tree
Showing 14 changed files with 387 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/ScaffoldingTester/Chinook/ErikEJ.Dacpac.Chinook.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="MSBuild.Sdk.SqlProj/3.0.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<SqlServerVersion>Sql150</SqlServerVersion>
<RunSqlCodeAnalysis>True</RunSqlCodeAnalysis>
<!-- For additional properties that can be set here, please refer to https://github.com/rr-wfm/MSBuild.Sdk.SqlProj#model-properties -->
<PackageProjectUrl>https://github.com/ErikEJ/EFCorePowerTools</PackageProjectUrl>
</PropertyGroup>

<PropertyGroup>
<!-- Refer to https://github.com/rr-wfm/MSBuild.Sdk.SqlProj#publishing-support for supported publishing options -->
</PropertyGroup>
</Project>
27 changes: 27 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Album.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CREATE TABLE [dbo].[Album] (
[AlbumId] INT IDENTITY (1, 1) NOT NULL,
[Title] NVARCHAR (160) NOT NULL,
[ArtistId] INT NOT NULL,
CONSTRAINT [PK_Album] PRIMARY KEY CLUSTERED ([AlbumId] ASC),
CONSTRAINT [FK_AlbumArtistId] FOREIGN KEY ([ArtistId]) REFERENCES [dbo].[Artist] ([ArtistId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_AlbumArtistId]
ON [dbo].[Album]([ArtistId] ASC);


GO

EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Title of album', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Album', @level2type = N'COLUMN', @level2name = N'Title';


GO

EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Album table', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Album';


GO

146 changes: 146 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Albums.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
CREATE VIEW dbo.Albums
AS
SELECT dbo.Album.Title, dbo.Artist.Name
FROM dbo.Album INNER JOIN
dbo.Artist ON dbo.Album.ArtistId = dbo.Artist.ArtistId

GO

EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'Albums';


GO

EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "Album"
Begin Extent =
Top = 7
Left = 48
Bottom = 148
Right = 242
End
DisplayFlags = 280
TopColumn = 0
End
Begin Table = "Artist"
Begin Extent =
Top = 7
Left = 290
Bottom = 182
Right = 484
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 7536
Width = 3780
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'Albums';


GO

9 changes: 9 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Artist.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE [dbo].[Artist] (
[ArtistId] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (120) NULL,
CONSTRAINT [PK_Artist] PRIMARY KEY CLUSTERED ([ArtistId] ASC)
);


GO

27 changes: 27 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Customer.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CREATE TABLE [dbo].[Customer] (
[CustomerId] INT IDENTITY (1, 1) NOT NULL,
[FirstName] NVARCHAR (40) NOT NULL,
[LastName] NVARCHAR (20) NOT NULL,
[Company] NVARCHAR (80) NULL,
[Address] NVARCHAR (70) NULL,
[City] NVARCHAR (40) NULL,
[State] NVARCHAR (40) NULL,
[Country] NVARCHAR (40) NULL,
[PostalCode] NVARCHAR (10) NULL,
[Phone] NVARCHAR (24) NULL,
[Fax] NVARCHAR (24) NULL,
[Email] NVARCHAR (60) NOT NULL,
[SupportRepId] INT NULL,
CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ([CustomerId] ASC),
CONSTRAINT [FK_CustomerSupportRepId] FOREIGN KEY ([SupportRepId]) REFERENCES [dbo].[Employee] ([EmployeeId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_CustomerSupportRepId]
ON [dbo].[Customer]([SupportRepId] ASC);


GO

29 changes: 29 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Employee.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CREATE TABLE [dbo].[Employee] (
[EmployeeId] INT IDENTITY (1, 1) NOT NULL,
[LastName] NVARCHAR (20) NOT NULL,
[FirstName] NVARCHAR (20) NOT NULL,
[Title] NVARCHAR (30) NULL,
[ReportsTo] INT NULL,
[BirthDate] DATETIME NULL,
[HireDate] DATETIME NULL,
[Address] NVARCHAR (70) NULL,
[City] NVARCHAR (40) NULL,
[State] NVARCHAR (40) NULL,
[Country] NVARCHAR (40) NULL,
[PostalCode] NVARCHAR (10) NULL,
[Phone] NVARCHAR (24) NULL,
[Fax] NVARCHAR (24) NULL,
[Email] NVARCHAR (60) NULL,
CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ([EmployeeId] ASC),
CONSTRAINT [FK_EmployeeReportsTo] FOREIGN KEY ([ReportsTo]) REFERENCES [dbo].[Employee] ([EmployeeId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_EmployeeReportsTo]
ON [dbo].[Employee]([ReportsTo] ASC);


GO

9 changes: 9 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Genre.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE [dbo].[Genre] (
[GenreId] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (120) NULL,
CONSTRAINT [PK_Genre] PRIMARY KEY CLUSTERED ([GenreId] ASC)
);


GO

23 changes: 23 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Invoice.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE [dbo].[Invoice] (
[InvoiceId] INT IDENTITY (1, 1) NOT NULL,
[CustomerId] INT NOT NULL,
[InvoiceDate] DATETIME NOT NULL,
[BillingAddress] NVARCHAR (70) NULL,
[BillingCity] NVARCHAR (40) NULL,
[BillingState] NVARCHAR (40) NULL,
[BillingCountry] NVARCHAR (40) NULL,
[BillingPostalCode] NVARCHAR (10) NULL,
[Total] NUMERIC (10, 2) NOT NULL,
CONSTRAINT [PK_Invoice] PRIMARY KEY CLUSTERED ([InvoiceId] ASC),
CONSTRAINT [FK_InvoiceCustomerId] FOREIGN KEY ([CustomerId]) REFERENCES [dbo].[Customer] ([CustomerId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_InvoiceCustomerId]
ON [dbo].[Invoice]([CustomerId] ASC);


GO

26 changes: 26 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/InvoiceLine.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE TABLE [dbo].[InvoiceLine] (
[InvoiceLineId] INT IDENTITY (1, 1) NOT NULL,
[InvoiceId] INT NOT NULL,
[TrackId] INT NOT NULL,
[UnitPrice] NUMERIC (10, 2) NOT NULL,
[Quantity] INT NOT NULL,
CONSTRAINT [PK_InvoiceLine] PRIMARY KEY CLUSTERED ([InvoiceLineId] ASC),
CONSTRAINT [FK_InvoiceLineInvoiceId] FOREIGN KEY ([InvoiceId]) REFERENCES [dbo].[Invoice] ([InvoiceId]),
CONSTRAINT [FK_InvoiceLineTrackId] FOREIGN KEY ([TrackId]) REFERENCES [dbo].[Track] ([TrackId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_InvoiceLineTrackId]
ON [dbo].[InvoiceLine]([TrackId] ASC);


GO

CREATE NONCLUSTERED INDEX [IFK_InvoiceLineInvoiceId]
ON [dbo].[InvoiceLine]([InvoiceId] ASC);


GO

9 changes: 9 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/MediaType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE [dbo].[MediaType] (
[MediaTypeId] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (120) NULL,
CONSTRAINT [PK_MediaType] PRIMARY KEY CLUSTERED ([MediaTypeId] ASC)
);


GO

9 changes: 9 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Playlist.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE [dbo].[Playlist] (
[PlaylistId] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (120) NULL,
CONSTRAINT [PK_Playlist] PRIMARY KEY CLUSTERED ([PlaylistId] ASC)
);


GO

17 changes: 17 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/PlaylistTrack.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE [dbo].[PlaylistTrack] (
[PlaylistId] INT NOT NULL,
[TrackId] INT NOT NULL,
CONSTRAINT [PK_PlaylistTrack] PRIMARY KEY NONCLUSTERED ([PlaylistId] ASC, [TrackId] ASC),
CONSTRAINT [FK_PlaylistTrackPlaylistId] FOREIGN KEY ([PlaylistId]) REFERENCES [dbo].[Playlist] ([PlaylistId]),
CONSTRAINT [FK_PlaylistTrackTrackId] FOREIGN KEY ([TrackId]) REFERENCES [dbo].[Track] ([TrackId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_PlaylistTrackTrackId]
ON [dbo].[PlaylistTrack]([TrackId] ASC);


GO

37 changes: 37 additions & 0 deletions test/ScaffoldingTester/Chinook/Tables/Track.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
CREATE TABLE [dbo].[Track] (
[TrackId] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (200) NOT NULL,
[AlbumId] INT NULL,
[MediaTypeId] INT NOT NULL,
[GenreId] INT NULL,
[Composer] NVARCHAR (220) NULL,
[Milliseconds] INT NOT NULL,
[Bytes] INT NULL,
[UnitPrice] NUMERIC (10, 2) NOT NULL,
CONSTRAINT [PK_Track] PRIMARY KEY CLUSTERED ([TrackId] ASC),
CONSTRAINT [FK_TrackAlbumId] FOREIGN KEY ([AlbumId]) REFERENCES [dbo].[Album] ([AlbumId]),
CONSTRAINT [FK_TrackGenreId] FOREIGN KEY ([GenreId]) REFERENCES [dbo].[Genre] ([GenreId]),
CONSTRAINT [FK_TrackMediaTypeId] FOREIGN KEY ([MediaTypeId]) REFERENCES [dbo].[MediaType] ([MediaTypeId])
);


GO

CREATE NONCLUSTERED INDEX [IFK_TrackAlbumId]
ON [dbo].[Track]([AlbumId] ASC);


GO

CREATE NONCLUSTERED INDEX [IFK_TrackGenreId]
ON [dbo].[Track]([GenreId] ASC);


GO

CREATE NONCLUSTERED INDEX [IFK_TrackMediaTypeId]
ON [dbo].[Track]([MediaTypeId] ASC);


GO

Loading

0 comments on commit 9f47edf

Please sign in to comment.