@@ -127,7 +127,9 @@ 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 date. Include parentheses in
132+ /// string, i.e. `"customDate()"`.
131133 /// - expression: The expression used to generate the datetime.
132134 /// - fileID: The source `#fileID` associated with the trigger.
133135 /// - line: The source `#line` associated with the trigger.
@@ -136,8 +138,8 @@ extension Table {
136138 public static func createTemporaryTrigger< D: _OptionalPromotable < Date ? > > (
137139 _ name: String ? = nil ,
138140 ifNotExists: Bool = false ,
139- afterUpdateTouch date : KeyPath < TableColumns , TableColumn < Self , D > > ,
140- expression : String = " datetime('subsec') " ,
141+ afterUpdateTouch dateColumn : KeyPath < TableColumns , TableColumn < Self , D > > ,
142+ date dateFunction : StaticString = " datetime('subsec') " ,
141143 fileID: StaticString = #fileID,
142144 line: UInt = #line,
143145 column: UInt = #column
@@ -146,7 +148,7 @@ extension Table {
146148 name,
147149 ifNotExists: ifNotExists,
148150 afterUpdateTouch: {
149- $0 [ dynamicMember: date ] = SQLQueryExpression ( " \( raw: expression ) " )
151+ $0 [ dynamicMember: dateColumn ] = SQLQueryExpression ( " \( raw: dateFunction . description ) " )
150152 } ,
151153 fileID: fileID,
152154 line: line,
@@ -207,15 +209,18 @@ extension Table {
207209 /// - name: The trigger's name. By default a unique name is generated depending using the table,
208210 /// operation, and source location.
209211 /// - ifNotExists: Adds an `IF NOT EXISTS` clause to the `CREATE TRIGGER` statement.
210- /// - 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 date. Include parentheses in
214+ /// string, i.e. `"customDate()"`.
211215 /// - fileID: The source `#fileID` associated with the trigger.
212216 /// - line: The source `#line` associated with the trigger.
213217 /// - column: The source `#column` associated with the trigger.
214218 /// - Returns: A temporary trigger.
215219 public static func createTemporaryTrigger< D: _OptionalPromotable < Date ? > > (
216220 _ name: String ? = nil ,
217221 ifNotExists: Bool = false ,
218- afterInsertTouch date: KeyPath < TableColumns , TableColumn < Self , D > > ,
222+ afterInsertTouch dateColumn: KeyPath < TableColumns , TableColumn < Self , D > > ,
223+ date dateFunction: StaticString = " datetime('subsec') " ,
219224 fileID: StaticString = #fileID,
220225 line: UInt = #line,
221226 column: UInt = #column
@@ -224,7 +229,7 @@ extension Table {
224229 name,
225230 ifNotExists: ifNotExists,
226231 afterInsertTouch: {
227- $0 [ dynamicMember: date ] = SQLQueryExpression ( " datetime('subsec' )" )
232+ $0 [ dynamicMember: dateColumn ] = SQLQueryExpression ( " \( raw : dateFunction . description ) " )
228233 } ,
229234 fileID: fileID,
230235 line: line,
0 commit comments