-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
71 changed files
with
10,043 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:drift/drift.dart'; | ||
import 'package:drift/internal/modular.dart'; | ||
|
||
import 'todo_tables.drift.dart'; | ||
|
||
// #docregion tables | ||
class TodoItems extends Table { | ||
IntColumn get id => integer().autoIncrement()(); | ||
TextColumn get title => text().withLength(min: 6, max: 32)(); | ||
TextColumn get content => text().named('body')(); | ||
IntColumn get category => integer().nullable().references(Categories, #id)(); | ||
// #enddocregion tables | ||
DateTimeColumn get dueDate => dateTime().nullable()(); | ||
// #docregion tables | ||
} | ||
|
||
@DataClassName('Category') | ||
class Categories extends Table { | ||
IntColumn get id => integer().autoIncrement()(); | ||
TextColumn get name => text()(); | ||
} | ||
// #enddocregion tables | ||
|
||
class Users extends Table { | ||
IntColumn get id => integer().autoIncrement()(); | ||
DateTimeColumn get birthDate => dateTime()(); | ||
} | ||
|
||
class CanUseCommonTables extends ModularAccessor { | ||
CanUseCommonTables(super.attachedDatabase); | ||
|
||
$TodoItemsTable get todoItems => resultSet('todo_items'); | ||
$CategoriesTable get categories => resultSet('categories'); | ||
$UsersTable get users => resultSet('users'); | ||
} |
Oops, something went wrong.