File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Tests/StructuredQueriesTests Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -186,28 +186,36 @@ extension SnapshotTests {
186186 }
187187 }
188188
189- @Test func uuid ( ) throws {
189+ @Test func uuidAndGeneratedColumn ( ) throws {
190190 try database. execute (
191191 #sql(
192192 """
193- CREATE TABLE " rows " (id TEXT PRIMARY KEY NOT NULL)
193+ CREATE TABLE " rows " (
194+ " id " TEXT PRIMARY KEY NOT NULL,
195+ " isDeleted " INTEGER NOT NULL DEFAULT 0,
196+ " isNotDeleted " INTEGER NOT NULL AS (NOT " isDeleted " )
197+ )
194198 """
195199 )
196200 )
197- try database. execute ( Row . insert { Row ( id: UUID ( 1 ) ) } )
201+ try database. execute ( Row . insert { Row . Draft ( id: UUID ( 1 ) ) } )
198202 assertQuery (
199203 Row . find ( UUID ( 1 ) )
200204 ) {
201205 """
202- SELECT " rows " . " id "
206+ SELECT " rows " . " id " , " rows " . " isDeleted " , " rows " . " isNotDeleted "
203207 FROM " rows "
204208 WHERE ( " rows " . " id " = '00000000-0000-0000-0000-000000000001')
205209 """
206210 } results: {
207211 """
208- ┌─────────────────────────────────────────────────────┐
209- │ Row(id: UUID(00000000-0000-0000-0000-000000000001)) │
210- └─────────────────────────────────────────────────────┘
212+ ┌───────────────────────────────────────────────────┐
213+ │ Row( │
214+ │ id: UUID(00000000-0000-0000-0000-000000000001), │
215+ │ isDeleted: false, │
216+ │ isNotDeleted: true │
217+ │ ) │
218+ └───────────────────────────────────────────────────┘
211219 """
212220 }
213221 }
@@ -222,4 +230,7 @@ extension SnapshotTests {
222230@Table
223231private struct Row {
224232 let id : UUID
233+ var isDeleted = false
234+ @Column ( generated: . virtual)
235+ let isNotDeleted : Bool
225236}
You can’t perform that action at this time.
0 commit comments