Skip to content

Commit

Permalink
Merge branch 'docs-restructure' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Sep 23, 2023
2 parents 4be60e7 + e8c868b commit 8c42ce5
Show file tree
Hide file tree
Showing 80 changed files with 3,264 additions and 1,714 deletions.
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ dart run build_runner serve web:8080 --live-reload
To build the website into a directory `out`, use:

```
dart run drift_dev schema steps lib/snippets/migrations/exported_eschema/ lib/database/schema_versions.dart
dart run drift_dev schema steps lib/snippets/migrations/exported_eschema/ lib/snippets/migrations/schema_versions.dart
dart run drift_dev schema generate --data-classes --companions lib/snippets/migrations/exported_eschema/ lib/snippets/migrations/tests/generated_migrations/
dart run build_runner build --release --output web:out
```
4 changes: 4 additions & 0 deletions docs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ targets:
version: "3.39"
generate_for:
include: &modular
- "lib/snippets/_shared/**"
- "lib/snippets/modular/**"
- "lib/snippets/drift_files/custom_queries.*"
drift_dev:modular:
enabled: true
options: *options
Expand Down Expand Up @@ -120,6 +122,8 @@ targets:
environment: "preview"
build_web_compilers:entrypoint:
generate_for:
include:
- "web/**"
exclude:
- "web/drift_worker.dart"
release_options:
Expand Down
26 changes: 26 additions & 0 deletions docs/lib/snippets/_shared/todo_tables.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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)();
}

@DataClassName('Category')
class Categories extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text()();
}
// #enddocregion tables

class CanUseCommonTables extends ModularAccessor {
CanUseCommonTables(super.attachedDatabase);

$TodoItemsTable get todoItems => resultSet('todo_items');
$CategoriesTable get categories => resultSet('categories');
}
Loading

0 comments on commit 8c42ce5

Please sign in to comment.