Skip to content

Commit e4d9835

Browse files
Fix queries to remove the "__EFMigrationsHistory" filter.
1 parent 6154840 commit e4d9835

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/UnitTests.Databases.SqlServer/SqlServerDatabaseObjectExtensions.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ [sys].[computed_columns] AS [cc]
302302
[sys].[tables] AS [t],
303303
[sys].[types] AS [ty]
304304
WHERE
305-
[t].[name] NOT IN ('__EFMigrationsHistory')
306-
AND [t].[object_id] = [c].[object_id]
305+
[t].[object_id] = [c].[object_id]
307306
AND [c].[user_type_id] = [ty].[user_type_id]";
308307

309308
var result = await database.ExecuteQueryAsync(sql, cancellationToken);
@@ -331,8 +330,7 @@ [fk].[update_referential_action_desc] AS [UpdateAction]
331330
[sys].[columns] AS [rc],
332331
[sys].[tables] AS [rt]
333332
WHERE
334-
[t].[name] NOT IN ('__EFMigrationsHistory')
335-
AND [t].[object_id] = [fk].[parent_object_id]
333+
[t].[object_id] = [fk].[parent_object_id]
336334
AND [fk].[object_id] = [fkc].[constraint_object_id]
337335
AND [fkc].[parent_column_id] = [pc].[column_id]
338336
AND [pc].[object_id] = [t].[object_id]
@@ -374,8 +372,7 @@ ELSE [ic].[index_column_id]
374372
[sys].[index_columns] AS [ic],
375373
[sys].[columns] AS [c]
376374
WHERE
377-
[t].[name] NOT IN ('__EFMigrationsHistory')
378-
AND [t].[object_id] = [i].[object_id]
375+
[t].[object_id] = [i].[object_id]
379376
AND [i].[is_unique_constraint] = 0
380377
AND [i].[object_id] = [ic].[object_id]
381378
AND [i].[index_id] = [ic].[index_id]
@@ -403,8 +400,7 @@ [ic].[key_ordinal] AS [Position]
403400
[sys].[index_columns] AS [ic],
404401
[sys].[columns] AS [c]
405402
WHERE
406-
[t].[name] NOT IN ('__EFMigrationsHistory')
407-
AND [t].[object_id] = [i].[object_id]
403+
[t].[object_id] = [i].[object_id]
408404
AND [i].[is_primary_key] = 1
409405
AND [i].[object_id] = [ic].[object_id]
410406
AND [i].[index_id] = [ic].[index_id]
@@ -433,8 +429,7 @@ [c].[name] AS [ColumnName]
433429
[sys].[index_columns] AS [ic],
434430
[sys].[columns] AS [c]
435431
WHERE
436-
[t].[name] NOT IN ('__EFMigrationsHistory')
437-
AND [t].[object_id] = [i].[object_id]
432+
[t].[object_id] = [i].[object_id]
438433
AND [i].[is_unique_constraint] = 1
439434
AND [i].[object_id] = [ic].[object_id]
440435
AND [i].[index_id] = [ic].[index_id]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
CREATE TABLE [dbo].[__EFMigrationsHistorySource]
22
(
3-
[Id] INT NOT NULL PRIMARY KEY
3+
[Id] INT NOT NULL,
4+
5+
CONSTRAINT [PK_EFMigrationsHistorySource]
6+
PRIMARY KEY NONCLUSTERED ([Id])
47
)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
CREATE TABLE [dbo].[__EFMigrationsHistoryTarget]
22
(
3-
[Id] INT NOT NULL PRIMARY KEY
3+
[Id] INT NOT NULL,
4+
5+
CONSTRAINT [PK_EFMigrationsHistoryTarget]
6+
PRIMARY KEY CLUSTERED ([Id])
47
)

0 commit comments

Comments
 (0)