Migrated angel_migration

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-02 15:36:33 +08:00
parent 69b7483794
commit 2deaf5d299
3 changed files with 11 additions and 12 deletions

View file

@ -2,23 +2,23 @@ import 'package:angel_orm/angel_orm.dart';
class MigrationColumn extends Column {
final List<MigrationColumnReference> _references = [];
bool _nullable;
IndexType _index;
late bool _nullable;
IndexType? _index;
dynamic _defaultValue;
@override
bool get isNullable => _nullable;
@override
IndexType get indexType => _index;
IndexType get indexType => _index!;
get defaultValue => _defaultValue;
List<MigrationColumnReference> get externalReferences =>
new List<MigrationColumnReference>.unmodifiable(_references);
MigrationColumn(ColumnType type,
{bool isNullable: true, int length, IndexType indexType, defaultValue})
MigrationColumn(ColumnType? type,
{bool isNullable: true, int? length, IndexType? indexType, defaultValue})
: super(type: type, length: length) {
_nullable = isNullable;
_index = indexType;
@ -49,11 +49,11 @@ class MigrationColumn extends Column {
class MigrationColumnReference {
final String foreignTable, foreignKey;
String _behavior;
String? _behavior;
MigrationColumnReference._(this.foreignTable, this.foreignKey);
String get behavior => _behavior;
String? get behavior => _behavior;
StateError _locked() =>
new StateError('Cannot override existing "$_behavior" behavior.');

View file

@ -29,7 +29,7 @@ abstract class Table {
MigrationColumn text(String name) => declare(name, ColumnType.text);
MigrationColumn varChar(String name, {int length}) {
MigrationColumn varChar(String name, {int? length}) {
if (length == null) return declare(name, ColumnType.varChar);
return declareColumn(
name, new Column(type: ColumnType.varChar, length: length));

View file

@ -1,14 +1,13 @@
name: angel_migration
version: 3.0.0
version: 4.0.0
description: Database migration runtime for Angel's ORM. Use this package to define schemas.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/migration
publish_to: none
environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
dependencies:
angel_orm:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
ref: sdk-2.12.x_nnbd
path: packages/orm/angel_orm