@@ -31,7 +31,7 @@ class Schema {
3131///
3232/// These options are enabled by passing them to a non-local [Table]
3333/// constructor.
34- final class IncludeOldOptions {
34+ final class TrackPreviousValuesOptions {
3535 /// A filter of column names for which updates should be tracked.
3636 ///
3737 /// When set to a non-null value, columns not included in this list will not
@@ -42,7 +42,8 @@ final class IncludeOldOptions {
4242 /// instead of always including all old values.
4343 final bool onlyWhenChanged;
4444
45- const IncludeOldOptions ({this .columnFilter, this .onlyWhenChanged = false });
45+ const TrackPreviousValuesOptions (
46+ {this .columnFilter, this .onlyWhenChanged = false });
4647}
4748
4849/// A single table in the schema.
@@ -61,12 +62,12 @@ class Table {
6162 /// Whether to add a hidden `_metadata` column that will be enabled for
6263 /// updates to attach custom information about writes that will be reported
6364 /// through [CrudEntry.metadata] .
64- final bool includeMetadata ;
65+ final bool trackMetadata ;
6566
6667 /// Whether to track old values of columns for [CrudEntry.oldData] .
6768 ///
68- /// See [IncludeOldOptions ] for details.
69- final IncludeOldOptions ? includeOld ;
69+ /// See [TrackPreviousValuesOptions ] for details.
70+ final TrackPreviousValuesOptions ? trackPreviousValues ;
7071
7172 /// Whether the table only exists locally.
7273 final bool localOnly;
@@ -76,7 +77,7 @@ class Table {
7677
7778 /// Whether an `UPDATE` statement that doesn't change any values should be
7879 /// ignored when creating CRUD entries.
79- final bool ignoreEmptyUpdate ;
80+ final bool ignoreEmptyUpdates ;
8081
8182 /// Override the name for the view
8283 final String ? _viewNameOverride;
@@ -107,9 +108,9 @@ class Table {
107108 this .indexes = const [],
108109 String ? viewName,
109110 this .localOnly = false ,
110- this .ignoreEmptyUpdate = false ,
111- this .includeMetadata = false ,
112- this .includeOld ,
111+ this .ignoreEmptyUpdates = false ,
112+ this .trackMetadata = false ,
113+ this .trackPreviousValues ,
113114 }) : insertOnly = false ,
114115 _viewNameOverride = viewName;
115116
@@ -120,9 +121,9 @@ class Table {
120121 {this .indexes = const [], String ? viewName})
121122 : localOnly = true ,
122123 insertOnly = false ,
123- includeMetadata = false ,
124- includeOld = null ,
125- ignoreEmptyUpdate = false ,
124+ trackMetadata = false ,
125+ trackPreviousValues = null ,
126+ ignoreEmptyUpdates = false ,
126127 _viewNameOverride = viewName;
127128
128129 /// Create a table that only supports inserts.
@@ -137,9 +138,9 @@ class Table {
137138 this .name,
138139 this .columns, {
139140 String ? viewName,
140- this .ignoreEmptyUpdate = false ,
141- this .includeMetadata = false ,
142- this .includeOld ,
141+ this .ignoreEmptyUpdates = false ,
142+ this .trackMetadata = false ,
143+ this .trackPreviousValues ,
143144 }) : localOnly = false ,
144145 insertOnly = true ,
145146 indexes = const [],
@@ -172,11 +173,11 @@ class Table {
172173 "Invalid characters in view name: $_viewNameOverride " );
173174 }
174175
175- if (includeMetadata && localOnly) {
176+ if (trackMetadata && localOnly) {
176177 throw AssertionError ("Local-only tables can't track metadata" );
177178 }
178179
179- if (includeOld != null && localOnly) {
180+ if (trackPreviousValues != null && localOnly) {
180181 throw AssertionError ("Local-only tables can't track old values" );
181182 }
182183
@@ -228,11 +229,11 @@ class Table {
228229 'insert_only' : insertOnly,
229230 'columns' : columns,
230231 'indexes' : indexes.map ((e) => e.toJson (this )).toList (growable: false ),
231- 'ignore_empty_update' : ignoreEmptyUpdate ,
232- 'include_metadata' : includeMetadata ,
233- if (includeOld case final includeOld ? ) ...{
234- 'include_old' : includeOld .columnFilter ?? true ,
235- 'include_old_only_when_changed' : includeOld .onlyWhenChanged,
232+ 'ignore_empty_update' : ignoreEmptyUpdates ,
233+ 'include_metadata' : trackMetadata ,
234+ if (trackPreviousValues case final trackPreviousValues ? ) ...{
235+ 'include_old' : trackPreviousValues .columnFilter ?? true ,
236+ 'include_old_only_when_changed' : trackPreviousValues .onlyWhenChanged,
236237 },
237238 };
238239}
0 commit comments