Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manager: ignores references whose target column is a foreign key itself #3278

Merged
merged 5 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
976 changes: 510 additions & 466 deletions docs/lib/snippets/_shared/todo_tables.drift.dart

Large diffs are not rendered by default.

284 changes: 142 additions & 142 deletions docs/lib/snippets/modular/custom_types/drift_table.drift.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,148 @@ import 'package:drift_docs/snippets/modular/custom_types/drift_table.drift.dart'
as i1;
import 'package:drift_docs/snippets/modular/custom_types/type.dart' as i2;

typedef $PeriodicRemindersCreateCompanionBuilder = i1.PeriodicRemindersCompanion
Function({
i0.Value<int> id,
required Duration frequency,
required String reminder,
});
typedef $PeriodicRemindersUpdateCompanionBuilder = i1.PeriodicRemindersCompanion
Function({
i0.Value<int> id,
i0.Value<Duration> frequency,
i0.Value<String> reminder,
});

class $PeriodicRemindersFilterComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.ColumnFilters<int> get id => $composableBuilder(
column: $table.id, builder: (column) => i0.ColumnFilters(column));

i0.ColumnFilters<Duration> get frequency => $composableBuilder(
column: $table.frequency, builder: (column) => i0.ColumnFilters(column));

i0.ColumnFilters<String> get reminder => $composableBuilder(
column: $table.reminder, builder: (column) => i0.ColumnFilters(column));
}

class $PeriodicRemindersOrderingComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.ColumnOrderings<int> get id => $composableBuilder(
column: $table.id, builder: (column) => i0.ColumnOrderings(column));

i0.ColumnOrderings<Duration> get frequency => $composableBuilder(
column: $table.frequency,
builder: (column) => i0.ColumnOrderings(column));

i0.ColumnOrderings<String> get reminder => $composableBuilder(
column: $table.reminder, builder: (column) => i0.ColumnOrderings(column));
}

class $PeriodicRemindersAnnotationComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);

i0.GeneratedColumn<Duration> get frequency =>
$composableBuilder(column: $table.frequency, builder: (column) => column);

i0.GeneratedColumn<String> get reminder =>
$composableBuilder(column: $table.reminder, builder: (column) => column);
}

class $PeriodicRemindersTableManager extends i0.RootTableManager<
i0.GeneratedDatabase,
i1.PeriodicReminders,
i1.PeriodicReminder,
i1.$PeriodicRemindersFilterComposer,
i1.$PeriodicRemindersOrderingComposer,
i1.$PeriodicRemindersAnnotationComposer,
$PeriodicRemindersCreateCompanionBuilder,
$PeriodicRemindersUpdateCompanionBuilder,
(
i1.PeriodicReminder,
i0.BaseReferences<i0.GeneratedDatabase, i1.PeriodicReminders,
i1.PeriodicReminder>
),
i1.PeriodicReminder,
i0.PrefetchHooks Function()> {
$PeriodicRemindersTableManager(
i0.GeneratedDatabase db, i1.PeriodicReminders table)
: super(i0.TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
i1.$PeriodicRemindersFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
i1.$PeriodicRemindersOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
i1.$PeriodicRemindersAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
i0.Value<int> id = const i0.Value.absent(),
i0.Value<Duration> frequency = const i0.Value.absent(),
i0.Value<String> reminder = const i0.Value.absent(),
}) =>
i1.PeriodicRemindersCompanion(
id: id,
frequency: frequency,
reminder: reminder,
),
createCompanionCallback: ({
i0.Value<int> id = const i0.Value.absent(),
required Duration frequency,
required String reminder,
}) =>
i1.PeriodicRemindersCompanion.insert(
id: id,
frequency: frequency,
reminder: reminder,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
));
}

typedef $PeriodicRemindersProcessedTableManager = i0.ProcessedTableManager<
i0.GeneratedDatabase,
i1.PeriodicReminders,
i1.PeriodicReminder,
i1.$PeriodicRemindersFilterComposer,
i1.$PeriodicRemindersOrderingComposer,
i1.$PeriodicRemindersAnnotationComposer,
$PeriodicRemindersCreateCompanionBuilder,
$PeriodicRemindersUpdateCompanionBuilder,
(
i1.PeriodicReminder,
i0.BaseReferences<i0.GeneratedDatabase, i1.PeriodicReminders,
i1.PeriodicReminder>
),
i1.PeriodicReminder,
i0.PrefetchHooks Function()>;

class PeriodicReminders extends i0.Table
with i0.TableInfo<PeriodicReminders, i1.PeriodicReminder> {
@override
Expand Down Expand Up @@ -230,145 +372,3 @@ class PeriodicRemindersCompanion
.toString();
}
}

typedef $PeriodicRemindersCreateCompanionBuilder = i1.PeriodicRemindersCompanion
Function({
i0.Value<int> id,
required Duration frequency,
required String reminder,
});
typedef $PeriodicRemindersUpdateCompanionBuilder = i1.PeriodicRemindersCompanion
Function({
i0.Value<int> id,
i0.Value<Duration> frequency,
i0.Value<String> reminder,
});

class $PeriodicRemindersFilterComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.ColumnFilters<int> get id => $composableBuilder(
column: $table.id, builder: (column) => i0.ColumnFilters(column));

i0.ColumnFilters<Duration> get frequency => $composableBuilder(
column: $table.frequency, builder: (column) => i0.ColumnFilters(column));

i0.ColumnFilters<String> get reminder => $composableBuilder(
column: $table.reminder, builder: (column) => i0.ColumnFilters(column));
}

class $PeriodicRemindersOrderingComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.ColumnOrderings<int> get id => $composableBuilder(
column: $table.id, builder: (column) => i0.ColumnOrderings(column));

i0.ColumnOrderings<Duration> get frequency => $composableBuilder(
column: $table.frequency,
builder: (column) => i0.ColumnOrderings(column));

i0.ColumnOrderings<String> get reminder => $composableBuilder(
column: $table.reminder, builder: (column) => i0.ColumnOrderings(column));
}

class $PeriodicRemindersAnnotationComposer
extends i0.Composer<i0.GeneratedDatabase, i1.PeriodicReminders> {
$PeriodicRemindersAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
i0.GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);

i0.GeneratedColumn<Duration> get frequency =>
$composableBuilder(column: $table.frequency, builder: (column) => column);

i0.GeneratedColumn<String> get reminder =>
$composableBuilder(column: $table.reminder, builder: (column) => column);
}

class $PeriodicRemindersTableManager extends i0.RootTableManager<
i0.GeneratedDatabase,
i1.PeriodicReminders,
i1.PeriodicReminder,
i1.$PeriodicRemindersFilterComposer,
i1.$PeriodicRemindersOrderingComposer,
i1.$PeriodicRemindersAnnotationComposer,
$PeriodicRemindersCreateCompanionBuilder,
$PeriodicRemindersUpdateCompanionBuilder,
(
i1.PeriodicReminder,
i0.BaseReferences<i0.GeneratedDatabase, i1.PeriodicReminders,
i1.PeriodicReminder>
),
i1.PeriodicReminder,
i0.PrefetchHooks Function()> {
$PeriodicRemindersTableManager(
i0.GeneratedDatabase db, i1.PeriodicReminders table)
: super(i0.TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
i1.$PeriodicRemindersFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
i1.$PeriodicRemindersOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
i1.$PeriodicRemindersAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
i0.Value<int> id = const i0.Value.absent(),
i0.Value<Duration> frequency = const i0.Value.absent(),
i0.Value<String> reminder = const i0.Value.absent(),
}) =>
i1.PeriodicRemindersCompanion(
id: id,
frequency: frequency,
reminder: reminder,
),
createCompanionCallback: ({
i0.Value<int> id = const i0.Value.absent(),
required Duration frequency,
required String reminder,
}) =>
i1.PeriodicRemindersCompanion.insert(
id: id,
frequency: frequency,
reminder: reminder,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
));
}

typedef $PeriodicRemindersProcessedTableManager = i0.ProcessedTableManager<
i0.GeneratedDatabase,
i1.PeriodicReminders,
i1.PeriodicReminder,
i1.$PeriodicRemindersFilterComposer,
i1.$PeriodicRemindersOrderingComposer,
i1.$PeriodicRemindersAnnotationComposer,
$PeriodicRemindersCreateCompanionBuilder,
$PeriodicRemindersUpdateCompanionBuilder,
(
i1.PeriodicReminder,
i0.BaseReferences<i0.GeneratedDatabase, i1.PeriodicReminders,
i1.PeriodicReminder>
),
i1.PeriodicReminder,
i0.PrefetchHooks Function()>;
Loading
Loading