1.0.0-alpha+7
This commit is contained in:
parent
2ca305a34b
commit
0adb48ce95
4 changed files with 25 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
# 1.0.0-alpha+7
|
||||
* Added a `@belongsToMany` annotation class.
|
||||
* Resolved [#20](https://github.com/angel-dart/orm/issues/20). The
|
||||
`PostgreSQLConnectionPool` keeps track of which connections have been opened now.
|
||||
|
||||
# 1.0.0-alpha+6
|
||||
* `DateTimeSqlExpressionBuilder` will no longer automatically
|
||||
insert quotation marks around names.
|
||||
|
|
|
@ -38,7 +38,10 @@ class PostgreSQLConnectionPool {
|
|||
var connection = _connections[_index++];
|
||||
if (_index >= _connections.length) _index = 0;
|
||||
|
||||
if (!_opened.contains(connection.hashCode)) await connection.open();
|
||||
if (!_opened.contains(connection.hashCode)) {
|
||||
await connection.open();
|
||||
_opened.add(connection.hashCode);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ abstract class RelationshipType {
|
|||
static const int HAS_MANY = 0;
|
||||
static const int HAS_ONE = 1;
|
||||
static const int BELONGS_TO = 2;
|
||||
static const int BELONGS_TO_MANY = 3;
|
||||
}
|
||||
|
||||
class Relationship {
|
||||
|
@ -24,7 +25,7 @@ class HasMany extends Relationship {
|
|||
String foreignKey,
|
||||
String foreignTable,
|
||||
bool cascadeOnDelete: false})
|
||||
: super(0,
|
||||
: super(RelationshipType.HAS_MANY,
|
||||
localKey: localKey,
|
||||
foreignKey: foreignKey,
|
||||
foreignTable: foreignTable,
|
||||
|
@ -39,7 +40,7 @@ class HasOne extends Relationship {
|
|||
String foreignKey,
|
||||
String foreignTable,
|
||||
bool cascadeOnDelete: false})
|
||||
: super(1,
|
||||
: super(RelationshipType.HAS_ONE,
|
||||
localKey: localKey,
|
||||
foreignKey: foreignKey,
|
||||
foreignTable: foreignTable,
|
||||
|
@ -51,10 +52,21 @@ const HasOne hasOne = const HasOne();
|
|||
class BelongsTo extends Relationship {
|
||||
const BelongsTo(
|
||||
{String localKey: 'id', String foreignKey, String foreignTable})
|
||||
: super(2,
|
||||
: super(RelationshipType.BELONGS_TO,
|
||||
localKey: localKey,
|
||||
foreignKey: foreignKey,
|
||||
foreignTable: foreignTable);
|
||||
}
|
||||
|
||||
const BelongsTo belongsTo = const BelongsTo();
|
||||
|
||||
class BelongsToMany extends Relationship {
|
||||
const BelongsToMany(
|
||||
{String localKey: 'id', String foreignKey, String foreignTable})
|
||||
: super(RelationshipType.BELONGS_TO_MANY,
|
||||
localKey: localKey,
|
||||
foreignKey: foreignKey,
|
||||
foreignTable: foreignTable);
|
||||
}
|
||||
|
||||
const BelongsToMany belongsToMany = const BelongsToMany();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_orm
|
||||
version: 1.0.0-alpha+6
|
||||
version: 1.0.0-alpha+7
|
||||
description: Runtime support for Angel's ORM.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/orm
|
||||
|
|
Loading…
Reference in a new issue