From b826391bcb655c861f0cd768082e1e1973b292b7 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Sun, 24 Sep 2023 15:39:38 +0200 Subject: [PATCH] Add aliases from old documentation URLs --- .../snippets/_shared/todo_tables.drift.dart | 10 +++-- docs/pages/docs/Dart API/schema_inspection.md | 3 ++ docs/pages/docs/Dart API/select.md | 3 ++ docs/pages/docs/Generation options/index.md | 6 +-- docs/pages/docs/Migrations/index.md | 1 + docs/pages/docs/Platforms/encryption.md | 2 + docs/pages/docs/Platforms/vm.md | 3 ++ docs/pages/docs/SQL API/custom_queries.md | 1 + docs/pages/docs/SQL API/drift_files.md | 1 + docs/pages/docs/SQL API/extensions.md | 3 ++ docs/pages/docs/custom_row_classes.md | 2 + docs/pages/docs/setup.md | 2 - docs/pages/docs/type_converters.md | 2 +- docs/templates/partials/dependencies.html | 38 ------------------- netlify.toml | 12 ++++++ 15 files changed, 41 insertions(+), 48 deletions(-) delete mode 100644 docs/templates/partials/dependencies.html diff --git a/docs/lib/snippets/_shared/todo_tables.drift.dart b/docs/lib/snippets/_shared/todo_tables.drift.dart index 3e22c747..704fc55f 100644 --- a/docs/lib/snippets/_shared/todo_tables.drift.dart +++ b/docs/lib/snippets/_shared/todo_tables.drift.dart @@ -45,9 +45,10 @@ class $TodoItemsTable extends i2.TodoItems @override List get $columns => [id, title, content, category]; @override - String get aliasedName => _alias ?? 'todo_items'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'todo_items'; + String get actualTableName => $name; + static const String $name = 'todo_items'; @override i0.VerificationContext validateIntegrity(i0.Insertable instance, {bool isInserting = false}) { @@ -285,9 +286,10 @@ class $CategoriesTable extends i2.Categories @override List get $columns => [id, name]; @override - String get aliasedName => _alias ?? 'categories'; + String get aliasedName => _alias ?? actualTableName; @override - String get actualTableName => 'categories'; + String get actualTableName => $name; + static const String $name = 'categories'; @override i0.VerificationContext validateIntegrity(i0.Insertable instance, {bool isInserting = false}) { diff --git a/docs/pages/docs/Dart API/schema_inspection.md b/docs/pages/docs/Dart API/schema_inspection.md index ecdd5e3d..e3f7f26c 100644 --- a/docs/pages/docs/Dart API/schema_inspection.md +++ b/docs/pages/docs/Dart API/schema_inspection.md @@ -3,6 +3,9 @@ data: title: Runtime schema inspection description: Use generated table classes to reflectively inspect the schema of your database. template: layouts/docs/single + +aliases: + - docs/advanced-features/schema_inspection/ --- {% assign snippets = 'package:drift_docs/snippets/modular/schema_inspection.dart.excerpt.json' | readString | json_decode %} diff --git a/docs/pages/docs/Dart API/select.md b/docs/pages/docs/Dart API/select.md index be276460..2bdabea2 100644 --- a/docs/pages/docs/Dart API/select.md +++ b/docs/pages/docs/Dart API/select.md @@ -4,6 +4,9 @@ data: description: "Select rows or invidiual columns from tables in Dart" weight: 2 template: layouts/docs/single + +aliases: + - docs/getting-started/writing_queries/ --- {% assign tables = 'package:drift_docs/snippets/_shared/todo_tables.dart.excerpt.json' | readString | json_decode %} diff --git a/docs/pages/docs/Generation options/index.md b/docs/pages/docs/Generation options/index.md index 33ca33f7..b2d77e09 100644 --- a/docs/pages/docs/Generation options/index.md +++ b/docs/pages/docs/Generation options/index.md @@ -4,9 +4,9 @@ data: description: Options for `drift_dev` and `build_runner` to change the generated code. weight: 7 template: layouts/docs/list -#path: docs/advanced-features/builder_options/ -#aliases: -# - "options/" +path: docs/advanced-features/builder_options/ +aliases: + - "options/" --- The `drift_dev` package supports a range of options that control how code diff --git a/docs/pages/docs/Migrations/index.md b/docs/pages/docs/Migrations/index.md index 44509268..3ea494d8 100644 --- a/docs/pages/docs/Migrations/index.md +++ b/docs/pages/docs/Migrations/index.md @@ -6,6 +6,7 @@ data: template: layouts/docs/list aliases: - /migrations + - /docs/advanced-features/migrations/ --- The strict schema of tables and columns is what enables type-safe queries to diff --git a/docs/pages/docs/Platforms/encryption.md b/docs/pages/docs/Platforms/encryption.md index 7e66ca07..9858a1ec 100644 --- a/docs/pages/docs/Platforms/encryption.md +++ b/docs/pages/docs/Platforms/encryption.md @@ -4,6 +4,8 @@ data: description: Use drift on encrypted databases weight: 10 template: layouts/docs/single +aliases: + - docs/other-engines/encryption/ --- {% assign snippets = 'package:drift_docs/snippets/platforms/encryption.dart.excerpt.json' | readString | json_decode %} diff --git a/docs/pages/docs/Platforms/vm.md b/docs/pages/docs/Platforms/vm.md index 7064794d..f509321a 100644 --- a/docs/pages/docs/Platforms/vm.md +++ b/docs/pages/docs/Platforms/vm.md @@ -4,6 +4,9 @@ data: description: Run drift on both mobile and desktop weight: 1 template: layouts/docs/single + +aliases: + - docs/other-engines/vm/ --- ## Supported platforms diff --git a/docs/pages/docs/SQL API/custom_queries.md b/docs/pages/docs/SQL API/custom_queries.md index 5e2304cc..167cb77a 100644 --- a/docs/pages/docs/SQL API/custom_queries.md +++ b/docs/pages/docs/SQL API/custom_queries.md @@ -5,6 +5,7 @@ data: description: Write SQL for advanced queries that drift can't express in Dart yet. aliases: - /queries/custom + - /docs/using-sql/custom_queries/ template: layouts/docs/single --- diff --git a/docs/pages/docs/SQL API/drift_files.md b/docs/pages/docs/SQL API/drift_files.md index 63d04409..d02f6feb 100644 --- a/docs/pages/docs/SQL API/drift_files.md +++ b/docs/pages/docs/SQL API/drift_files.md @@ -7,6 +7,7 @@ data: aliases: - /docs/using-sql/custom_tables/ # Redirect from outdated "custom tables" page which has been deleted - /docs/using-sql/moor_files/ + - /docs/using-sql/drift_files/ template: layouts/docs/single --- diff --git a/docs/pages/docs/SQL API/extensions.md b/docs/pages/docs/SQL API/extensions.md index 8af50e74..d23c8bf9 100644 --- a/docs/pages/docs/SQL API/extensions.md +++ b/docs/pages/docs/SQL API/extensions.md @@ -4,6 +4,9 @@ data: weight: 10 description: Information on json1 and fts5 support in drift files template: layouts/docs/single + +aliases: + - docs/using-sql/extensions/ --- When analyzing `.drift` files, the generator can consider sqlite3 extensions diff --git a/docs/pages/docs/custom_row_classes.md b/docs/pages/docs/custom_row_classes.md index 4d57e10f..8cad8c1e 100644 --- a/docs/pages/docs/custom_row_classes.md +++ b/docs/pages/docs/custom_row_classes.md @@ -5,6 +5,8 @@ data: description: >- Use your own classes as data classes for drift tables template: layouts/docs/single + +path: docs/advanced-features/custom_row_classes/ --- For each table declared in Dart or in a drift file, `drift_dev` generates a row class (sometimes also referred to as _data class_) diff --git a/docs/pages/docs/setup.md b/docs/pages/docs/setup.md index d02021ce..81c9836f 100644 --- a/docs/pages/docs/setup.md +++ b/docs/pages/docs/setup.md @@ -27,8 +27,6 @@ If you want to look at an example app for inspiration, a cross-platform Flutter ## The dependencies {#adding-dependencies} First, lets add drift to your project's `pubspec.yaml`. -At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift) -and the latest version of `drift_dev` is [![Generator version](https://img.shields.io/pub/v/drift_dev.svg)](https://pub.dev/packages/drift_dev). In addition to the core drift dependencies, we're also adding packages to find a suitable database location on the device and to include a recent version of `sqlite3`, the database most commonly used with drift. diff --git a/docs/pages/docs/type_converters.md b/docs/pages/docs/type_converters.md index 18bd6b95..af25d65f 100644 --- a/docs/pages/docs/type_converters.md +++ b/docs/pages/docs/type_converters.md @@ -5,7 +5,7 @@ data: description: Store more complex data in columns with type converters aliases: - /type_converters -path: /docs/advanced_features/type_converters/ +path: /docs/advanced-features/type_converters/ template: layouts/docs/single --- diff --git a/docs/templates/partials/dependencies.html b/docs/templates/partials/dependencies.html deleted file mode 100644 index 1bb3fdc6..00000000 --- a/docs/templates/partials/dependencies.html +++ /dev/null @@ -1,38 +0,0 @@ -{% block "blocks/markdown" %} - -First, lets add drift to your project's `pubspec.yaml`. -At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift) -and the latest version of `drift_dev` is [![Generator version](https://img.shields.io/pub/v/drift_dev.svg)](https://pub.dev/packages/drift_dev). - -{% assign versions = 'package:drift_docs/versions.json' | readString | json_decode %} - -```yaml -dependencies: - drift: ^{{ versions.drift }} - sqlite3_flutter_libs: ^0.5.0 - path_provider: ^2.0.0 - path: ^{{ versions.path }} - -dev_dependencies: - drift_dev: ^{{ versions.drift_dev }} - build_runner: ^{{ versions.build_runner }} -``` - -If you're wondering why so many packages are necessary, here's a quick overview over what each package does: - -- `drift`: This is the core package defining the APIs you use to access drift databases. -- `sqlite3_flutter_libs`: Ships the latest `sqlite3` version with your Android or iOS app. This is not required when you're _not_ using Flutter, - but then you need to take care of including `sqlite3` yourself. - Note that the `sqlite3_flutter_libs` package will include the native sqlite3 library for the following - architectures: `armv8`, `armv7`, `x86` and `x86_64`. - Most Flutter apps don't run on 32-bit x86 devices without further setup, so you should - [add a snippet](https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3_flutter_libs#included-platforms) - to your `build.gradle` if you don't need `x86` builds. - Otherwise, the Play Store might allow users on `x86` devices to install your app even though it is not - supported. - In Flutter's current native build system, drift unfortunately can't do that for you. -- `path_provider` and `path`: Used to find a suitable location to store the database. Maintained by the Flutter and Dart team. -- `drift_dev`: This development-only dependency generates query code based on your tables. It will not be included in your final app. -- `build_runner`: Common tool for code-generation, maintained by the Dart team. - -{% endblock %} \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index e2de9174..85439783 100644 --- a/netlify.toml +++ b/netlify.toml @@ -21,6 +21,18 @@ status = 301 force = true +[[redirects]] + from = "/docs/getting-started/starting_with_sql/" + to = "/docs/sql-api/#setup" + status = 301 + force = true + +[[redirects]] + from = "/docs/advanced-features/joins/" + to = "/docs/dart-api/select/#joins" + status = 301 + force = true + [[headers]] for = "/*" [headers.values]