@@ -127,15 +127,19 @@ extension Table {
127127 /// - name: The trigger's name. By default a unique name is generated depending using the table,
128128 /// operation, and source location.
129129 /// - ifNotExists: Adds an `IF NOT EXISTS` clause to the `CREATE TRIGGER` statement.
130- /// - date: A key path to a datetime column.
130+ /// - dateColumn: A key path to a datetime column.
131+ /// - dateFunction: A database function that returns the current datetime, _e.g._,
132+ /// `#sql("datetime('subsec'))"`.
133+ /// - expression: The expression used to generate the datetime.
131134 /// - fileID: The source `#fileID` associated with the trigger.
132135 /// - line: The source `#line` associated with the trigger.
133136 /// - column: The source `#column` associated with the trigger.
134137 /// - Returns: A temporary trigger.
135138 public static func createTemporaryTrigger< D: _OptionalPromotable < Date ? > > (
136139 _ name: String ? = nil ,
137140 ifNotExists: Bool = false ,
138- afterUpdateTouch date: KeyPath < TableColumns , TableColumn < Self , D > > ,
141+ afterUpdateTouch dateColumn: KeyPath < TableColumns , TableColumn < Self , D > > ,
142+ date dateFunction: any QueryExpression < D > = SQLQueryExpression < D > ( " datetime('subsec') " ) ,
139143 fileID: StaticString = #fileID,
140144 line: UInt = #line,
141145 column: UInt = #column
@@ -144,7 +148,7 @@ extension Table {
144148 name,
145149 ifNotExists: ifNotExists,
146150 afterUpdateTouch: {
147- $0 [ dynamicMember: date ] = SQLQueryExpression ( " datetime('subsec') " )
151+ $0 [ dynamicMember: dateColumn ] = dateFunction
148152 } ,
149153 fileID: fileID,
150154 line: line,
@@ -205,15 +209,18 @@ extension Table {
205209 /// - name: The trigger's name. By default a unique name is generated depending using the table,
206210 /// operation, and source location.
207211 /// - ifNotExists: Adds an `IF NOT EXISTS` clause to the `CREATE TRIGGER` statement.
208- /// - date: A key path to a datetime column.
212+ /// - dateColumn: A key path to a datetime column.
213+ /// - dateFunction: A database function that returns the current datetime, _e.g._,
214+ /// `#sql("datetime('subsec'))"`.
209215 /// - fileID: The source `#fileID` associated with the trigger.
210216 /// - line: The source `#line` associated with the trigger.
211217 /// - column: The source `#column` associated with the trigger.
212218 /// - Returns: A temporary trigger.
213219 public static func createTemporaryTrigger< D: _OptionalPromotable < Date ? > > (
214220 _ name: String ? = nil ,
215221 ifNotExists: Bool = false ,
216- afterInsertTouch date: KeyPath < TableColumns , TableColumn < Self , D > > ,
222+ afterInsertTouch dateColumn: KeyPath < TableColumns , TableColumn < Self , D > > ,
223+ date dateFunction: any QueryExpression < D > = SQLQueryExpression < D > ( " datetime('subsec') " ) ,
217224 fileID: StaticString = #fileID,
218225 line: UInt = #line,
219226 column: UInt = #column
@@ -222,7 +229,7 @@ extension Table {
222229 name,
223230 ifNotExists: ifNotExists,
224231 afterInsertTouch: {
225- $0 [ dynamicMember: date ] = SQLQueryExpression ( " datetime('subsec') " )
232+ $0 [ dynamicMember: dateColumn ] = dateFunction
226233 } ,
227234 fileID: fileID,
228235 line: line,
0 commit comments