Updated ORM

This commit is contained in:
thomashii@dukefirehawk.com 2023-05-27 08:37:00 +08:00
parent a1f0512f5a
commit 435fbe4e1a
20 changed files with 219 additions and 190 deletions

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.1.0 ## 7.1.0
* Require Dart >= 2.18 * Require Dart >= 2.18

View file

@ -1,14 +1,14 @@
name: angel3_migration name: angel3_migration
version: 7.1.0 version: 8.0.0
description: Database migration runtime for Angel3 ORM. Use this package to define schemas. description: Database migration runtime for Angel3 ORM. Use this package to define schemas.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration
environment: environment:
sdk: '>=2.18.0 <3.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
dev_dependencies: dev_dependencies:
lints: ^2.0.0 lints: ^2.1.0
# dependency_overrides: dependency_overrides:
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.1.0 ## 7.1.0
* Require Dart >= 2.18 * Require Dart >= 2.18

View file

@ -86,6 +86,7 @@ class MySqlMigrationRunner implements MigrationRunner {
"INSERT INTO migrations (batch, path) VALUES ($curBatch, '$k')") "INSERT INTO migrations (batch, path) VALUES ($curBatch, '$k')")
.catchError((e) { .catchError((e) {
_log.severe('Failed to insert into "migrations" table.', e); _log.severe('Failed to insert into "migrations" table.', e);
throw Exception(e);
}); });
return result.affectedRows.toInt(); return result.affectedRows.toInt();

View file

@ -22,6 +22,7 @@ class MySqlSchema extends Schema {
var sql = compile(); var sql = compile();
var result = await ctx.execute(sql).catchError((e) { var result = await ctx.execute(sql).catchError((e) {
_log.severe('Failed to run query: [ $sql ]', e); _log.severe('Failed to run query: [ $sql ]', e);
throw Exception(e);
}); });
affectedRows = result.affectedRows.toInt(); affectedRows = result.affectedRows.toInt();
}).catchError((e) { }).catchError((e) {

View file

@ -20,6 +20,7 @@ class PostgresSchema extends Schema {
var sql = compile(); var sql = compile();
var result = await ctx.query(sql).catchError((e) { var result = await ctx.query(sql).catchError((e) {
_log.severe('Failed to run query: [ $sql ]', e); _log.severe('Failed to run query: [ $sql ]', e);
throw Exception(e);
}); });
return result.affectedRowCount; return result.affectedRowCount;
}); });

View file

@ -1,23 +1,23 @@
name: angel3_migration_runner name: angel3_migration_runner
version: 7.1.0 version: 8.0.0
description: Command-line based database migration runner for Angel3's ORM. description: Command-line based database migration runner for Angel3's ORM.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_migration: ^7.0.0 angel3_migration: ^8.0.0
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
args: ^2.1.0 args: ^2.4.0
charcode: ^1.3.0 charcode: ^1.3.0
postgres: ^2.6.0 postgres: ^2.6.0
mysql_client: ^0.0.26 mysql_client: ^0.0.27
mysql1: ^0.20.0 mysql1: ^0.20.0
logging: ^1.1.0 logging: ^1.2.0
dev_dependencies: dev_dependencies:
lints: ^2.0.0 lints: ^2.1.0
# dependency_overrides: dependency_overrides:
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.1.0 ## 7.1.0
* Require Dart >= 2.18 * Require Dart >= 2.18

View file

@ -1,28 +1,28 @@
name: angel3_orm name: angel3_orm
version: 7.1.0 version: 8.0.0
description: Runtime support for Angel3 ORM. Includes base classes for queries. description: Runtime support for Angel3 ORM. Includes base classes for queries.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm
environment: environment:
sdk: '>=2.18.0 <3.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
charcode: ^1.3.0 charcode: ^1.3.0
intl: ^0.17.0 intl: ^0.18.0
meta: ^1.3.0 meta: ^1.9.0
string_scanner: ^1.1.0 string_scanner: ^1.2.0
optional: ^6.1.0 optional: ^6.1.0
logging: ^1.0.0 logging: ^1.2.0
dev_dependencies: dev_dependencies:
angel3_model: ^7.0.0 angel3_model: ^8.0.0
angel3_serialize: ^7.0.0 angel3_serialize: ^8.0.0
angel3_serialize_generator: ^7.0.0 angel3_serialize_generator: ^8.0.0
build_runner: ^2.1.1 build_runner: ^2.4.0
test: ^1.17.4 test: ^1.24.0
lints: ^2.0.0 lints: ^2.1.0
# dependency_overrides: dependency_overrides:
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_serialize_generator: angel3_serialize_generator:
# path: ../../serialize/angel_serialize_generator path: ../../serialize/angel_serialize_generator
# angel3_model: angel3_model:
# path: ../../model path: ../../model

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.2.0-beta.1 ## 7.2.0-beta.1
* [Breaking] Require Dart >= 2.19 * [Breaking] Require Dart >= 2.19

View file

@ -1,4 +1,3 @@
//export 'src/mongodb_orm_generator.dart';
export 'src/migration_generator.dart'; export 'src/migration_generator.dart';
export 'src/orm_build_context.dart'; export 'src/orm_build_context.dart';
export 'src/orm_generator.dart'; export 'src/orm_generator.dart';

View file

@ -1,54 +1,54 @@
name: angel3_orm_generator name: angel3_orm_generator
version: 7.2.0-beta.1 version: 8.0.0
description: Code generators for Angel3 ORM. Generates query builder classes. description: Code generators for Angel3 ORM. Generates query builder classes.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_model: ^7.0.0 angel3_model: ^8.0.0
angel3_serialize: ^7.0.0 angel3_serialize: ^8.0.0
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
angel3_serialize_generator: ^7.2.0-beta.1 angel3_serialize_generator: ^8.0.0
analyzer: ^5.3.0 analyzer: ^5.13.0
inflection3: ^0.5.3+1 inflection3: ^0.5.3+2
build: ^2.0.1 build: ^2.4.0
build_config: ^1.0.0 build_config: ^1.1.0
code_builder: ^4.0.0 code_builder: ^4.4.0
dart_style: ^2.0.1 dart_style: ^2.3.0
meta: ^1.3.0 meta: ^1.9.0
path: ^1.8.0 path: ^1.8.0
recase: ^4.0.0 recase: ^4.1.0
source_gen: ^1.0.0 source_gen: ^1.3.0
collection: ^1.15.0 collection: ^1.17.0
logging: ^1.0.0 logging: ^1.2.0
optional: ^6.0.0 optional: ^6.0.0
dev_dependencies: dev_dependencies:
angel3_framework: ^7.0.0 angel3_framework: ^8.0.0
angel3_migration: ^7.0.0 angel3_migration: ^8.0.0
build_runner: ^2.0.1 build_runner: ^2.4.0
postgres: ^2.4.0 postgres: ^2.4.0
test: ^1.21.0 test: ^1.24.0
lints: ^2.0.0 lints: ^2.1.0
#dependency_overrides: dependency_overrides:
# angel3_container: angel3_container:
# path: ../../container/angel_container path: ../../container/angel_container
# angel3_framework: angel3_framework:
# path: ../../framework path: ../../framework
# angel3_http_exception: angel3_http_exception:
# path: ../../http_exception path: ../../http_exception
# angel3_model: angel3_model:
# path: ../../model path: ../../model
# angel3_route: angel3_route:
# path: ../../route path: ../../route
# angel3_mock_request: angel3_mock_request:
# path: ../../mock_request path: ../../mock_request
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_serialize_generator: angel3_serialize_generator:
# path: ../../serialize/angel_serialize_generator path: ../../serialize/angel_serialize_generator
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration

View file

@ -1,35 +1,35 @@
name: angel3_orm_mysql name: angel3_orm_mysql
version: 7.1.0-beta.1 version: 8.0.0
description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions. description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
logging: ^1.1.0 logging: ^1.2.0
mysql1: ^0.20.0 mysql1: ^0.20.0
mysql_client: ^0.0.27 mysql_client: ^0.0.27
optional: ^6.1.0 optional: ^6.1.0
dev_dependencies: dev_dependencies:
angel3_orm_generator: ^7.1.0-beta.1 angel3_orm_generator: ^8.0.0
angel3_orm_test: ^7.2.0-beta.1 angel3_orm_test: ^8.0.0
build_runner: ^2.0.1 build_runner: ^2.4.0
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^2.1.0
dependency_overrides: dependency_overrides:
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_serialize_generator: angel3_serialize_generator:
# path: ../../serialize/angel_serialize_generator path: ../../serialize/angel_serialize_generator
# angel3_model: angel3_model:
# path: ../../model path: ../../model
angel3_orm_test: angel3_orm_test:
path: ../angel_orm_test path: ../angel_orm_test
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
angel3_orm_generator: angel3_orm_generator:
path: ../angel_orm_generator path: ../angel_orm_generator
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration

View file

@ -1,8 +1,5 @@
import 'package:angel3_orm_test/angel3_orm_test.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'common.dart';
void main() async { void main() async {
//hierarchicalLoggingEnabled = true; //hierarchicalLoggingEnabled = true;
Logger.root Logger.root

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.1.0-beta.1 ## 7.1.0-beta.1
* Require Dart >= 2.19 * Require Dart >= 2.19

View file

@ -1,32 +1,34 @@
name: angel3_orm_postgres name: angel3_orm_postgres
version: 7.1.0-beta.1 version: 8.0.0
description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions. description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
logging: ^1.1.0 logging: ^1.2.0
pool: ^1.5.0 pool: ^1.5.0
postgres: ^2.6.1 postgres: ^2.6.1
postgres_pool: ^2.1.6 postgres_pool: ^2.1.6
dev_dependencies: dev_dependencies:
belatuk_pretty_logging: ^5.0.0 belatuk_pretty_logging: ^6.0.0
angel3_orm_generator: ^7.1.0-beta.1 angel3_orm_generator: ^8.0.0
angel3_orm_test: ^7.2.0-beta.1 angel3_orm_test: ^8.0.0
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^2.1.0
dependency_overrides: dependency_overrides:
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_model: angel3_serialize_generator:
# path: ../../model path: ../../serialize/angel_serialize_generator
angel3_model:
path: ../../model
angel3_orm_test: angel3_orm_test:
path: ../angel_orm_test path: ../angel_orm_test
angel3_orm_genrator: angel3_orm_generator:
path: ../angel_orm_generator path: ../angel_orm_generator
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration

View file

@ -1,5 +1,9 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.0.0 ## 7.0.0
* Require Dart >= 2.17 * Require Dart >= 2.17

View file

@ -1,51 +1,51 @@
name: angel3_orm_service name: angel3_orm_service
version: 7.0.0 version: 8.0.0
description: Service implementation that wraps over Angel3 ORM Query classes. description: Service implementation that wraps over Angel3 ORM Query classes.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_service repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_service
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_framework: ^7.0.0 angel3_framework: ^8.0.0
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
postgres: ^2.4.0 postgres: ^2.4.0
optional: ^6.0.0 optional: ^6.0.0
dev_dependencies: dev_dependencies:
angel3_migration: ^7.0.0 angel3_migration: ^8.0.0
angel3_migration_runner: ^7.0.0 angel3_migration_runner: ^8.0.0
angel3_orm_generator: ^7.0.0 angel3_orm_generator: ^8.0.0
angel3_orm_postgres: ^7.0.0 angel3_orm_postgres: ^8.0.0
angel3_serialize: ^7.0.0 angel3_serialize: ^8.0.0
build_runner: ^2.0.4 build_runner: ^2.4.0
logging: ^1.0.1 logging: ^1.2.0
test: ^1.21.0 test: ^1.24.0
lints: ^2.0.0 lints: ^2.1.0
# dependency_overrides: dependency_overrides:
# angel3_container: angel3_container:
# path: ../../container/angel_container path: ../../container/angel_container
# angel3_framework: angel3_framework:
# path: ../../framework path: ../../framework
# angel3_http_exception: angel3_http_exception:
# path: ../../http_exception path: ../../http_exception
# angel3_model: angel3_model:
# path: ../../model path: ../../model
# angel3_route: angel3_route:
# path: ../../route path: ../../route
# angel3_mock_request: angel3_mock_request:
# path: ../../mock_request path: ../../mock_request
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_serialize_generator: angel3_serialize_generator:
# path: ../../serialize/angel_serialize_generator path: ../../serialize/angel_serialize_generator
# angel3_orm_test: angel3_orm_test:
# path: ../angel_orm_test path: ../angel_orm_test
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
# angel3_orm_generator: angel3_orm_generator:
# path: ../angel_orm_generator path: ../angel_orm_generator
# angel3_orm_postgres: angel3_orm_postgres:
# path: ../angel_orm_postgres path: ../angel_orm_postgres
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration
# angel3_migration_runner: angel3_migration_runner:
# path: ../angel_migration_runner path: ../angel_migration_runner

View file

@ -1,12 +1,16 @@
# Change Log # Change Log
## 8.0.0
* Require Dart >= 3.0
## 7.2.0-beta.1 ## 7.2.0-beta.1
* [Breaking] Require Dart >= 2.19 * Require Dart >= 2.19
## 7.1.0 ## 7.1.0
* [Breaking] Require Dart >= 2.18 * Require Dart >= 2.18
## 7.0.2 ## 7.0.2

View file

@ -1,44 +1,44 @@
name: angel3_orm_test name: angel3_orm_test
version: 7.2.0-beta.1 version: 8.0.0
description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files. description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_test repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_test
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dependencies: dependencies:
angel3_migration: ^7.0.0 angel3_migration: ^8.0.0
angel3_model: ^7.0.0 angel3_model: ^8.0.0
angel3_orm: ^7.0.0 angel3_orm: ^8.0.0
angel3_serialize: ^7.0.0 angel3_serialize: ^8.0.0
io: ^1.0.0 io: ^1.0.0
test: ^1.24.0 test: ^1.24.0
collection: ^1.15.0 collection: ^1.17.0
optional: ^6.1.0 optional: ^6.1.0
dev_dependencies: dev_dependencies:
angel3_orm_generator: ^7.1.0-beta.1 angel3_orm_generator: ^8.0.0
angel3_framework: ^7.0.0 angel3_framework: ^8.0.0
build_runner: ^2.0.1 build_runner: ^2.4.0
lints: ^2.0.0 lints: ^2.1.0
dependency_overrides: dependency_overrides:
# angel3_container: angel3_container:
# path: ../../container/angel_container path: ../../container/angel_container
# angel3_framework: angel3_framework:
# path: ../../framework path: ../../framework
# angel3_http_exception: angel3_http_exception:
# path: ../../http_exception path: ../../http_exception
# angel3_model: angel3_model:
# path: ../../model path: ../../model
# angel3_route: angel3_route:
# path: ../../route path: ../../route
# angel3_mock_request: angel3_mock_request:
# path: ../../mock_request path: ../../mock_request
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_serialize_generator: angel3_serialize_generator:
# path: ../../serialize/angel_serialize_generator path: ../../serialize/angel_serialize_generator
# angel3_orm: angel3_orm:
# path: ../angel_orm path: ../angel_orm
# angel3_migration: angel3_migration:
# path: ../angel_migration path: ../angel_migration
angel3_orm_generator: angel3_orm_generator:
path: ../angel_orm_generator path: ../angel_orm_generator