Updated the ORM example

This commit is contained in:
thomashii 2021-07-25 17:11:58 +08:00
parent fab33a543c
commit b120ba505f
4 changed files with 20 additions and 2 deletions

3
.gitignore vendored
View file

@ -78,7 +78,7 @@ crashlytics-build.properties
fabric.properties fabric.properties
### VSCode template ### VSCode template
.vscode/* .vscode/
!.vscode/settings.json !.vscode/settings.json
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
@ -90,4 +90,3 @@ logs/
server_log.txt server_log.txt
.metals/ .metals/
.vscode/

View file

@ -27,6 +27,12 @@ This is an ORM starter application for [Angel3 framework](https://pub.dartlang.o
time_zone: UTC time_zone: UTC
``` ```
5. Run the migration to generate `migrations` and `greetings` tables in the database.
```bash
dart bin/migration.dart
```
### Development ### Development
1. Run the following command to start Angel3 server in dev mode to *hot-reloaded* on file changes: 1. Run the following command to start Angel3 server in dev mode to *hot-reloaded* on file changes:

View file

@ -4,8 +4,20 @@ import 'package:angel3_configuration/angel3_configuration.dart';
import 'package:angel3_migration_runner/angel3_migration_runner.dart'; import 'package:angel3_migration_runner/angel3_migration_runner.dart';
import 'package:angel3_migration_runner/postgres.dart'; import 'package:angel3_migration_runner/postgres.dart';
import 'package:file/local.dart'; import 'package:file/local.dart';
import 'package:logging/logging.dart';
void main(List<String> args) async { void main(List<String> args) async {
// Enable the logging
Logger.root.level = Level.INFO;
Logger.root.onRecord.listen((rec) {
print('${rec.time}: ${rec.level.name}: ${rec.loggerName}: ${rec.message}');
if (rec.error != null) {
print(rec.error);
print(rec.stackTrace);
}
});
var fs = LocalFileSystem(); var fs = LocalFileSystem();
var configuration = await loadStandaloneConfiguration(fs); var configuration = await loadStandaloneConfiguration(fs);
var connection = await connectToPostgres(configuration); var connection = await connectToPostgres(configuration);

View file

@ -18,6 +18,7 @@ dependencies:
angel3_validate: ^4.0.0 angel3_validate: ^4.0.0
angel3_pretty_logging: ^3.0.0 angel3_pretty_logging: ^3.0.0
optional: ^6.0.0-nullsafety.2 optional: ^6.0.0-nullsafety.2
logging: ^1.0.0
dev_dependencies: dev_dependencies:
angel3_hot: ^4.0.0 angel3_hot: ^4.0.0
angel3_migration_runner: ^4.0.0-beta.1 angel3_migration_runner: ^4.0.0-beta.1