From 9f47edf20478d4a7438c94a7489b0beac8eadf51 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Tue, 17 Dec 2024 14:12:45 +0100 Subject: [PATCH] Add proper .dacpac project (#2740) --- .../Chinook/ErikEJ.Dacpac.Chinook.csproj | 13 ++ .../Chinook/Tables/Album.sql | 27 ++++ .../Chinook/Tables/Albums.sql | 146 ++++++++++++++++++ .../Chinook/Tables/Artist.sql | 9 ++ .../Chinook/Tables/Customer.sql | 27 ++++ .../Chinook/Tables/Employee.sql | 29 ++++ .../Chinook/Tables/Genre.sql | 9 ++ .../Chinook/Tables/Invoice.sql | 23 +++ .../Chinook/Tables/InvoiceLine.sql | 26 ++++ .../Chinook/Tables/MediaType.sql | 9 ++ .../Chinook/Tables/Playlist.sql | 9 ++ .../Chinook/Tables/PlaylistTrack.sql | 17 ++ .../Chinook/Tables/Track.sql | 37 +++++ test/ScaffoldingTester/ScaffoldingTester.sln | 6 + 14 files changed, 387 insertions(+) create mode 100644 test/ScaffoldingTester/Chinook/ErikEJ.Dacpac.Chinook.csproj create mode 100644 test/ScaffoldingTester/Chinook/Tables/Album.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Albums.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Artist.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Customer.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Employee.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Genre.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Invoice.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/InvoiceLine.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/MediaType.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Playlist.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/PlaylistTrack.sql create mode 100644 test/ScaffoldingTester/Chinook/Tables/Track.sql diff --git a/test/ScaffoldingTester/Chinook/ErikEJ.Dacpac.Chinook.csproj b/test/ScaffoldingTester/Chinook/ErikEJ.Dacpac.Chinook.csproj new file mode 100644 index 000000000..2c5a8830a --- /dev/null +++ b/test/ScaffoldingTester/Chinook/ErikEJ.Dacpac.Chinook.csproj @@ -0,0 +1,13 @@ + + + netstandard2.1 + Sql150 + True + + https://github.com/ErikEJ/EFCorePowerTools + + + + + + \ No newline at end of file diff --git a/test/ScaffoldingTester/Chinook/Tables/Album.sql b/test/ScaffoldingTester/Chinook/Tables/Album.sql new file mode 100644 index 000000000..04c51172a --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Album.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Albums.sql b/test/ScaffoldingTester/Chinook/Tables/Albums.sql new file mode 100644 index 000000000..0c7edfb78 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Albums.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Artist.sql b/test/ScaffoldingTester/Chinook/Tables/Artist.sql new file mode 100644 index 000000000..5da188ec9 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Artist.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Customer.sql b/test/ScaffoldingTester/Chinook/Tables/Customer.sql new file mode 100644 index 000000000..099f9aada --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Customer.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Employee.sql b/test/ScaffoldingTester/Chinook/Tables/Employee.sql new file mode 100644 index 000000000..620ba4785 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Employee.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Genre.sql b/test/ScaffoldingTester/Chinook/Tables/Genre.sql new file mode 100644 index 000000000..8b00eddd9 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Genre.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Invoice.sql b/test/ScaffoldingTester/Chinook/Tables/Invoice.sql new file mode 100644 index 000000000..7c1deb289 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Invoice.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/InvoiceLine.sql b/test/ScaffoldingTester/Chinook/Tables/InvoiceLine.sql new file mode 100644 index 000000000..9447ba006 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/InvoiceLine.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/MediaType.sql b/test/ScaffoldingTester/Chinook/Tables/MediaType.sql new file mode 100644 index 000000000..e68126078 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/MediaType.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Playlist.sql b/test/ScaffoldingTester/Chinook/Tables/Playlist.sql new file mode 100644 index 000000000..b6b489843 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Playlist.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/PlaylistTrack.sql b/test/ScaffoldingTester/Chinook/Tables/PlaylistTrack.sql new file mode 100644 index 000000000..0fb2b31cd --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/PlaylistTrack.sql @@ -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 + diff --git a/test/ScaffoldingTester/Chinook/Tables/Track.sql b/test/ScaffoldingTester/Chinook/Tables/Track.sql new file mode 100644 index 000000000..044fe2cb9 --- /dev/null +++ b/test/ScaffoldingTester/Chinook/Tables/Track.sql @@ -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 + diff --git a/test/ScaffoldingTester/ScaffoldingTester.sln b/test/ScaffoldingTester/ScaffoldingTester.sln index 92e994f8f..25a97f148 100644 --- a/test/ScaffoldingTester/ScaffoldingTester.sln +++ b/test/ScaffoldingTester/ScaffoldingTester.sln @@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseBuild", "DatabaseBu EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostgresTester", "PostgresTester\PostgresTester.csproj", "{6494E379-EA19-4FBE-88FD-5ED13E154C1A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErikEJ.Dacpac.Chinook", "Chinook\ErikEJ.Dacpac.Chinook.csproj", "{2C2610B4-C031-4837-8193-53015185689D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -59,6 +61,10 @@ Global {6494E379-EA19-4FBE-88FD-5ED13E154C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {6494E379-EA19-4FBE-88FD-5ED13E154C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {6494E379-EA19-4FBE-88FD-5ED13E154C1A}.Release|Any CPU.Build.0 = Release|Any CPU + {2C2610B4-C031-4837-8193-53015185689D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C2610B4-C031-4837-8193-53015185689D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C2610B4-C031-4837-8193-53015185689D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C2610B4-C031-4837-8193-53015185689D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE