mirror of
https://github.com/immich-app/drift.git
synced 2026-09-30 13:22:57 +08:00
Make new website buildable
This commit is contained in:
+12
-7
@@ -1,15 +1,20 @@
|
||||
# drift_website
|
||||
|
||||
A documentation site built with Jaspr
|
||||
Documentation for the Drift project, built with `jaspr_content`.
|
||||
|
||||
## Running the project
|
||||
## Building the Documentation
|
||||
|
||||
Run your project using `jaspr serve`.
|
||||
To start the website for preview purposes, run
|
||||
|
||||
```shell
|
||||
dart run jaspr_cli:jaspr serve --no-managed-build-options
|
||||
```
|
||||
|
||||
The development server will be available on `http://localhost:8080`.
|
||||
|
||||
## Building the project
|
||||
To build the website, run:
|
||||
|
||||
Build your project using `jaspr build`.
|
||||
|
||||
The output will be located inside the `build/jaspr/` directory.
|
||||
```shell
|
||||
dart run jaspr_cli:jaspr serve --no-managed-build-options
|
||||
rm -r build/jaspr/packages build/jaspr/.dart_tool build/jaspr/.build.manifest
|
||||
```
|
||||
|
||||
@@ -77,20 +77,27 @@ LazyDatabase _openConnection() {
|
||||
}
|
||||
```
|
||||
|
||||
=== "Using `drift_flutter`"
|
||||
<Tabs>
|
||||
|
||||
{{ load_snippet('(full)','lib/snippets/examples/existing_databases_flutter.dart.excerpt.json',indent=4) }}
|
||||
<TabItem label="Using drift_flutter" value="drift_flutter">
|
||||
|
||||
=== "Using `package:drift/native.dart`"
|
||||
<Snippet href="/lib/src/snippets/examples/existing_databases_flutter.dart" name="(full)" />
|
||||
|
||||
In drift, you can use a [LazyDatabase](https://pub.dev/documentation/drift/latest/drift/LazyDatabase-class.html)
|
||||
to perform that work just before your drift database is opened:
|
||||
</TabItem>
|
||||
|
||||
{{ load_snippet('(full)','lib/snippets/examples/existing_databases_native.dart.excerpt.json',indent=4) }}
|
||||
<TabItem label="Using package:drift/native.dart" value="drift_native">
|
||||
|
||||
In drift, you can use a [LazyDatabase](https://pub.dev/documentation/drift/latest/drift/LazyDatabase-class.html)
|
||||
to perform that work just before your drift database is opened:
|
||||
|
||||
<Snippet href="/lib/src/snippets/examples/existing_databases_native.dart" name="(full)" />
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
!!! warning
|
||||
This snippet only works on native platforms. See [existing databases on the web](../Platforms/web.md#using-existing-databases) for web support.
|
||||
This snippet only works on native platforms. See [existing databases on the web](../platforms/web.md#using-existing-databases) for web support.
|
||||
|
||||
Finally, use that method to open your database:
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ Additional patterns are also shown and explained on this website:
|
||||
[web_worker]: https://github.com/simolus3/drift/tree/develop/examples/web_worker_example
|
||||
[flutter_web_worker]: https://github.com/simolus3/drift/tree/develop/examples/flutter_web_worker_example
|
||||
[migration]: https://github.com/simolus3/drift/tree/develop/examples/migrations_example
|
||||
[migration tooling](../Migrations/tests.md#verifying-data-integrity)
|
||||
[migration tooling](../migrations/tests.md#verifying-data-integrity)
|
||||
[with_built_value]: https://github.com/simolus3/drift/tree/develop/examples/with_built_value
|
||||
[multi_package]: https://github.com/simolus3/drift/tree/develop/examples/multi_package
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ description: Approaches for syncing drift databases between clients and backends
|
||||
|
||||
At its core, drift is a package to access relational databases. On clients, that would
|
||||
typically be a SQLite3 database, which is what drift is optimized for.
|
||||
More recently, drift also gained stable support for [PostgreSQL databases](../Platforms/postgres.md) as well.
|
||||
More recently, drift also gained stable support for [PostgreSQL databases](../platforms/postgres.md) as well.
|
||||
This allows drift to be deployed in [fullstack Dart applications](https://github.com/simolus3/drift/tree/develop/examples/multi_package),
|
||||
where a server uses drift to talk to a Postgres database and clients use it to manage a sqlite3 database.
|
||||
Thanks to utilities like [DialectAwareSqlType](https://pub.dev/documentation/drift/latest/drift/DialectAwareSqlType-class.html),
|
||||
|
||||
@@ -188,7 +188,7 @@ We currently support the following extensions:
|
||||
different tables. This requires a build flag when compiling SQLite. `sqlite3_flutter_libs` sets that flag,
|
||||
but other SQLite distributions might not.
|
||||
- `moor_ffi`: Enables support for functions that are only available when using a `NativeDatabase`. This contains `pow`, `sqrt` and a variety
|
||||
of trigonometric functions. Details on those functions are available [here](../Platforms/vm.md#drift-only-functions).
|
||||
of trigonometric functions. Details on those functions are available [here](../platforms/vm.md#drift-only-functions).
|
||||
- `math`: Assumes that sqlite3 was compiled with [math functions](https://www.sqlite.org/lang_mathfunc.html).
|
||||
This module is largely incompatible with the `moor_ffi` module.
|
||||
- `spellfix1`: Assumes that the [spellfix1](https://www.sqlite.org/spellfix1.html)
|
||||
|
||||
@@ -108,7 +108,7 @@ Also, you may have to
|
||||
|
||||
- Format your sources again: Run `dart format .`.
|
||||
- Re-run the build: Run `dart run build_runner build -d`.
|
||||
- If you have been using generated [migration test files](Migrations/exports.md),
|
||||
- If you have been using generated [migration test files](../migrations/exports.md),
|
||||
re-generate them as well with `dart run drift_dev schema generate drift_schemas/ test/generated_migrations/`
|
||||
(you may have to adapt the command to the directories you use for schemas).
|
||||
- Manually fix the changed order of imports caused by the migration.
|
||||
@@ -189,7 +189,7 @@ If you opt for a rename, also update your imports and `include:` parameters in d
|
||||
|
||||
#### Build configuration
|
||||
|
||||
When configuring moor builders for [options](generation_options/index.md), you have to update your `build.yaml` files to reflect the new builder keys:
|
||||
When configuring moor builders for [options](../generation_options/index.md), you have to update your `build.yaml` files to reflect the new builder keys:
|
||||
|
||||
| Moor builder key | Drift builder key |
|
||||
| ------------------------------------------- | ------------------------------ |
|
||||
|
||||
@@ -91,7 +91,7 @@ This section lists affected APIs and workarounds to make them work PostgreSQL.
|
||||
Most parts of the `Migrator` API are SQLite-specific. You will be able to create tables on PostgreSQL as well,
|
||||
but methods like `alterTable` will only work with SQLite.
|
||||
While it's possible to use drift migrations with PostgreSQL databases, the recommended approach for now is to
|
||||
[export your drift schema](../Tools/index.md#exporting) and then use dedicated migration tools for PostgreSQL.
|
||||
[export your drift schema](../tools/index.md#exporting) and then use dedicated migration tools for PostgreSQL.
|
||||
|
||||
In sqlite3, the current schema version is stored in the database file. To support drift's migration API
|
||||
being built on top of this mechanism in Postgres as well, drift creates a `__schema` table storing
|
||||
|
||||
@@ -19,7 +19,7 @@ final class PageRef implements CustomComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (url.extension(href.path) == '.md') {
|
||||
if (href.authority == '' && url.extension(href.path) == '.md') {
|
||||
return _PageLink(ref: href, child: builder.build(children));
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ final class _PageLink extends StatelessComponent {
|
||||
);
|
||||
|
||||
if (referencedPage == null) {
|
||||
return BrokenComponent('broken link to $resolvedRef');
|
||||
return BrokenComponent('broken link to ${ref.path} from ${page.path}');
|
||||
}
|
||||
|
||||
return a(
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -23,7 +23,7 @@ dependencies:
|
||||
sqlcipher_flutter_libs: ^0.6.8
|
||||
test: ^1.26.3
|
||||
rxdart: ^0.28.0
|
||||
jaspr_content_snippets: ^0.1.2
|
||||
jaspr_content_snippets: ^0.1.3
|
||||
glob: ^2.1.3
|
||||
markdown: ^7.3.0
|
||||
|
||||
@@ -36,6 +36,14 @@ dev_dependencies:
|
||||
json_serializable: ^6.11.1
|
||||
sass_builder: ^2.3.1
|
||||
|
||||
jaspr_cli:
|
||||
# This stops jaspr from messing with the builder configuration. Upstream PR:
|
||||
# https://github.com/schultek/jaspr/pull/592
|
||||
git:
|
||||
url: https://github.com/simolus3/jaspr.git
|
||||
ref: c9c59cea8e64de2f4cd135e162ac69a9f3df1312
|
||||
path: packages/jaspr_cli
|
||||
|
||||
jaspr:
|
||||
mode: static
|
||||
|
||||
|
||||
Reference in New Issue
Block a user