Skip to content

Commit 99adcfe

Browse files
committed
SchemaIncludesAndFilter
1 parent 7ea3eb1 commit 99adcfe

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Tables
2+
3+
### MyTable
4+
5+
```sql
6+
CREATE TABLE [dbo].[MyTable](
7+
[Value] [int] NULL
8+
) ON [PRIMARY]
9+
10+
CREATE NONCLUSTERED INDEX [MyIndex] ON [dbo].[MyTable]
11+
(
12+
[Value] ASC
13+
) ON [PRIMARY]
14+
15+
CREATE TRIGGER MyTrigger
16+
ON MyTable
17+
AFTER UPDATE
18+
AS RAISERROR ('Notify Customer Relations', 16, 10);
19+
20+
ALTER TABLE [dbo].[MyTable] ENABLE TRIGGER [MyTrigger]
21+
```
22+
23+
## Views
24+
25+
### MyView
26+
27+
```sql
28+
CREATE VIEW MyView
29+
AS
30+
SELECT Value
31+
FROM MyTable
32+
WHERE (Value > 10);
33+
```

src/Tests/Tests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,4 +832,17 @@ await Verify(connection)
832832
.SchemaFilter(_ => _.Name == "MultiIndexTable")
833833
.SchemaIncludes(DbObjects.Tables);
834834
}
835+
836+
[Test]
837+
public async Task SchemaIncludesAndFilter()
838+
{
839+
await using var database = await sqlInstance.Build();
840+
var connection = database.Connection;
841+
842+
// SchemaIncludes restricts to tables and views,
843+
// SchemaFilter further restricts by name.
844+
await Verify(connection)
845+
.SchemaIncludes(DbObjects.Tables | DbObjects.Views)
846+
.SchemaFilter(_ => _.Name is "MyTable" or "MyView" or "MyProcedure");
847+
}
835848
}

0 commit comments

Comments
 (0)