Merge branch 'master' into feature/doc

This commit is contained in:
Thomas Hii 2024-07-15 07:43:49 +08:00
commit b5b9412814
4 changed files with 50 additions and 13 deletions

View file

@ -4,7 +4,7 @@
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_framework?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/angel_dart/discussion)
[![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM)
[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/LICENSE)
[![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos)
@ -18,16 +18,15 @@ Angel3 originated from a fork of the archived Angel framework in support of Dart
The available features in Angel3 includes:
* Server-Side Rendering (Markdown, Mustache, Jinja, JAEL)
* OAuth2 Authentication
* WebSocket
* HTTP/2
* HTTP Streaming
* GraphQL
* ORM for PostgreSQL
* ORM for MySQL
* MongoDB
* Cache
* Markdown, Mustache, Jinja and JAEL as Server-Side HTML Rendering
* ORM for PostgreSQL and MySQL
* MongoDB, Sembast and RethinkDB as storage
* Redis as cache
See all of the available [`packages`](https://angel3-docs.dukefirehawk.com/packages) for more information.
@ -47,7 +46,7 @@ The status of the project is as follows:
Branch: `master`
* Dart version : 3.0.x or later.
* Dart version : 3.x.x or later.
* Publish : Yes. Refer to packages with `angel3_` prefix on [pub.dev](https://pub.dev/publishers/dukefirehawk.com/packages).
* Null Safety : Yes
* Status : Production
@ -66,6 +65,7 @@ For more details, checkout [Project Status](https://github.com/dart-backend/ange
* Updated `angel3_` packages to require dart >= 3.0.0
* Updated dependencies to the latest
* Updated code generator to use `analyzer` 6.x.x
* Resolved issues related to generated container
### Release 7.0.0
@ -92,9 +92,8 @@ For more details, checkout [Project Status](https://github.com/dart-backend/ange
* Improve ORM for MySQL
* Add cache support in ORM (using Redis)
* Upgrade and release angel3_oauth2 8.0.0 (5 failed test cases)
* Upgrade and release angel3_auth_twitter 8.0.0 (issue: oauth1 don't support http 1.0.0)
* Upgrade and release angel3_auth_twitter 8.0.0 (Migrate to OAuth2)
* Upgrade and release angel3_shelf 8.0.0 (2 failed test cases)
* Migrate and release angel3_rethink
## Installation and Setup
@ -162,9 +161,7 @@ Check out [Migrating to Angel3](https://angel3-docs.dukefirehawk.com/migration/a
## Performance Benchmark
The performance benchmark can be found at
[TechEmpower Framework Benchmarks Round 22](https://www.techempower.com/benchmarks/#section=data-r22&test=composite)
The performance benchmark can be found at [TechEmpower Framework Benchmarks](https://www.techempower.com/benchmarks/#section=data-r22&test=composite&hw=ph)
The test cases are build using standard `Angel3 ORM` template for PostgreSQL and MySQL database. The result are used for fine-tuning Angel3 framework with respect to other frameworks. The following test cases will be added in the upcoming update to the benchmark.
@ -175,6 +172,10 @@ The test cases are build using standard `Angel3 ORM` template for PostgreSQL and
Please visit our [User Guide](https://angel3-docs.dukefirehawk.com/) and [Examples](https://github.com/dart-backend/angel3-examples) for more detailed information on the available features of Angel3 framework.
## Community
Join us on [Discord](https://discord.gg/3X6bxTUdCM).
## Contributing
If you are interested in contributing to Angel3 framework please check out the [Contribution Guide](CONTRIBUTING.md).

View file

@ -21,7 +21,7 @@ class MigrationColumn extends Column {
MigrationColumn(ColumnType type,
{bool isNullable = true,
super.length,
IndexType indexType = IndexType.standardIndex,
IndexType indexType = IndexType.none,
dynamic defaultValue})
: super(type: type, isNullable: isNullable, defaultValue: defaultValue) {
_nullable = isNullable;

View file

@ -57,6 +57,14 @@ abstract class MariaDbGenerator {
return buf.toString();
}
static String? compileIndex(String name, MigrationColumn column) {
if (column.indexType == IndexType.standardIndex) {
return ' INDEX(`$name`)';
}
return null;
}
static String compileReference(MigrationColumnReference ref) {
var buf = StringBuffer('REFERENCES ${ref.foreignTable}(${ref.foreignKey})');
if (ref.behavior != null) buf.write(' ${ref.behavior!}');
@ -79,6 +87,7 @@ class MariaDbTable extends Table {
void compile(StringBuffer buf, int indent) {
var i = 0;
List indexBuf = [];
_columns.forEach((name, column) {
var col = MariaDbGenerator.compileColumn(column);
@ -89,7 +98,16 @@ class MariaDbTable extends Table {
}
buf.write('$name $col');
var index = MariaDbGenerator.compileIndex(name, column);
if (index != null) indexBuf.add(index);
});
if (indexBuf.isNotEmpty) {
for (var i = 0; i < indexBuf.length; i++) {
buf.write(',\n${indexBuf[$1]}');
}
}
}
}

View file

@ -56,6 +56,14 @@ abstract class MySqlGenerator {
return buf.toString();
}
static String? compileIndex(String name, MigrationColumn column) {
if (column.indexType == IndexType.standardIndex) {
return ' INDEX(`$name`)';
}
return null;
}
static String compileReference(MigrationColumnReference ref) {
var buf = StringBuffer('REFERENCES ${ref.foreignTable}(${ref.foreignKey})');
if (ref.behavior != null) buf.write(' ${ref.behavior!}');
@ -78,6 +86,7 @@ class MysqlTable extends Table {
void compile(StringBuffer buf, int indent) {
var i = 0;
List indexBuf = [];
_columns.forEach((name, column) {
var col = MySqlGenerator.compileColumn(column);
@ -88,7 +97,16 @@ class MysqlTable extends Table {
}
buf.write('$name $col');
var index = MySqlGenerator.compileIndex(name, column);
if (index != null) indexBuf.add(index);
});
if (indexBuf.isNotEmpty) {
for (var i = 0; i < indexBuf.length; i++) {
buf.write(',\n${indexBuf[$1]}');
}
}
}
}