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 { class MigrationColumn extends Column {
final List<MigrationColumnReference> _references = []; final List<MigrationColumnReference> _references = [];
bool _nullable; late bool _nullable;
IndexType _index; IndexType? _index;
dynamic _defaultValue; dynamic _defaultValue;
@override @override
bool get isNullable => _nullable; bool get isNullable => _nullable;
@override @override
IndexType get indexType => _index; IndexType get indexType => _index!;
get defaultValue => _defaultValue; get defaultValue => _defaultValue;
List<MigrationColumnReference> get externalReferences => List<MigrationColumnReference> get externalReferences =>
new List<MigrationColumnReference>.unmodifiable(_references); new List<MigrationColumnReference>.unmodifiable(_references);
MigrationColumn(ColumnType type, MigrationColumn(ColumnType? type,
{bool isNullable: true, int length, IndexType indexType, defaultValue}) {bool isNullable: true, int? length, IndexType? indexType, defaultValue})
: super(type: type, length: length) { : super(type: type, length: length) {
_nullable = isNullable; _nullable = isNullable;
_index = indexType; _index = indexType;
@ -49,11 +49,11 @@ class MigrationColumn extends Column {
class MigrationColumnReference { class MigrationColumnReference {
final String foreignTable, foreignKey; final String foreignTable, foreignKey;
String _behavior; String? _behavior;
MigrationColumnReference._(this.foreignTable, this.foreignKey); MigrationColumnReference._(this.foreignTable, this.foreignKey);
String get behavior => _behavior; String? get behavior => _behavior;
StateError _locked() => StateError _locked() =>
new StateError('Cannot override existing "$_behavior" behavior.'); 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 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); if (length == null) return declare(name, ColumnType.varChar);
return declareColumn( return declareColumn(
name, new Column(type: ColumnType.varChar, length: length)); name, new Column(type: ColumnType.varChar, length: length));

View file

@ -1,14 +1,13 @@
name: angel_migration 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. 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 homepage: https://github.com/angel-dart/migration
publish_to: none publish_to: none
environment: environment:
sdk: '>=2.10.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
angel_orm: angel_orm:
git: git:
url: https://github.com/dukefirehawk/angel.git url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x ref: sdk-2.12.x_nnbd
path: packages/orm/angel_orm path: packages/orm/angel_orm