diff --git a/.gitignore b/.gitignore index e1e5311..b2ffcef 100644 --- a/.gitignore +++ b/.gitignore @@ -78,7 +78,7 @@ crashlytics-build.properties fabric.properties ### VSCode template -.vscode/* +.vscode/ !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json @@ -90,4 +90,3 @@ logs/ server_log.txt .metals/ -.vscode/ diff --git a/README.md b/README.md index dedb098..92626a3 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,12 @@ This is an ORM starter application for [Angel3 framework](https://pub.dartlang.o time_zone: UTC ``` +5. Run the migration to generate `migrations` and `greetings` tables in the database. + + ```bash + dart bin/migration.dart + ``` + ### Development 1. Run the following command to start Angel3 server in dev mode to *hot-reloaded* on file changes: diff --git a/bin/migrate.dart b/bin/migrate.dart index 755ffe3..0474245 100644 --- a/bin/migrate.dart +++ b/bin/migrate.dart @@ -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/postgres.dart'; import 'package:file/local.dart'; +import 'package:logging/logging.dart'; void main(List 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 configuration = await loadStandaloneConfiguration(fs); var connection = await connectToPostgres(configuration); diff --git a/pubspec.yaml b/pubspec.yaml index 6db7c9c..fd09e0a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,6 +18,7 @@ dependencies: angel3_validate: ^4.0.0 angel3_pretty_logging: ^3.0.0 optional: ^6.0.0-nullsafety.2 + logging: ^1.0.0 dev_dependencies: angel3_hot: ^4.0.0 angel3_migration_runner: ^4.0.0-beta.1