Publish migration
This commit is contained in:
parent
eb9f79ab85
commit
ebdb634a95
9 changed files with 32 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
|||
# 4.0.0
|
||||
# 4.0.0-beta.1
|
||||
* Migrated to support Dart SDK 2.12.x NNBD
|
||||
|
||||
# 3.0.0
|
||||
|
|
|
@ -1,2 +1,8 @@
|
|||
# migration
|
||||
# angel3_migration
|
||||
[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_migration)
|
||||
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
||||
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
||||
|
||||
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration/LICENSE)
|
||||
|
||||
A PostgreSQL database migration framework built on Angel's ORM.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
include: package:pedantic/analysis_options.yaml
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
|
@ -1,9 +1,9 @@
|
|||
/// These are straightforward migrations.
|
||||
///
|
||||
/// You will likely never have to actually write these yourself.
|
||||
library angel_migration.example.todo;
|
||||
library angel3_migration.example.todo;
|
||||
|
||||
import 'package:angel_migration/angel_migration.dart';
|
||||
import 'package:angel3_migration/angel3_migration.dart';
|
||||
|
||||
class UserMigration implements Migration {
|
||||
@override
|
||||
|
|
0
packages/orm/angel_migration/lib/angel_migration.dart → packages/orm/angel_migration/lib/angel3_migration.dart
Executable file → Normal file
0
packages/orm/angel_migration/lib/angel_migration.dart → packages/orm/angel_migration/lib/angel3_migration.dart
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
|||
import 'package:angel_orm/angel_orm.dart';
|
||||
import 'package:angel3_orm/angel3_orm.dart';
|
||||
|
||||
class MigrationColumn extends Column {
|
||||
final List<MigrationColumnReference> _references = [];
|
||||
|
@ -12,10 +12,10 @@ class MigrationColumn extends Column {
|
|||
@override
|
||||
IndexType get indexType => _index!;
|
||||
|
||||
get defaultValue => _defaultValue;
|
||||
dynamic get defaultValue => _defaultValue;
|
||||
|
||||
List<MigrationColumnReference> get externalReferences =>
|
||||
new List<MigrationColumnReference>.unmodifiable(_references);
|
||||
List<MigrationColumnReference>.unmodifiable(_references);
|
||||
|
||||
MigrationColumn(ColumnType? type,
|
||||
{bool isNullable: true, int? length, IndexType? indexType, defaultValue})
|
||||
|
@ -27,7 +27,7 @@ class MigrationColumn extends Column {
|
|||
|
||||
factory MigrationColumn.from(Column column) => column is MigrationColumn
|
||||
? column
|
||||
: new MigrationColumn(column.type,
|
||||
: MigrationColumn(column.type,
|
||||
isNullable: column.isNullable,
|
||||
length: column.length,
|
||||
indexType: column.indexType);
|
||||
|
@ -41,7 +41,7 @@ class MigrationColumn extends Column {
|
|||
MigrationColumn primaryKey() => this.._index = IndexType.primaryKey;
|
||||
|
||||
MigrationColumnReference references(String foreignTable, String foreignKey) {
|
||||
var ref = new MigrationColumnReference._(foreignTable, foreignKey);
|
||||
var ref = MigrationColumnReference._(foreignTable, foreignKey);
|
||||
_references.add(ref);
|
||||
return ref;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class MigrationColumnReference {
|
|||
String? get behavior => _behavior;
|
||||
|
||||
StateError _locked() =>
|
||||
new StateError('Cannot override existing "$_behavior" behavior.');
|
||||
StateError('Cannot override existing "$_behavior" behavior.');
|
||||
|
||||
void onDeleteCascade() {
|
||||
if (_behavior != null) throw _locked();
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import 'table.dart';
|
||||
|
||||
abstract class Schema {
|
||||
void drop(String tableName, {bool cascade: false});
|
||||
void drop(String tableName, {bool cascade = false});
|
||||
|
||||
void dropAll(Iterable<String> tableNames, {bool cascade: false}) {
|
||||
void dropAll(Iterable<String> tableNames, {bool cascade = false}) {
|
||||
tableNames.forEach((n) => drop(n, cascade: cascade));
|
||||
}
|
||||
|
||||
void create(String tableName, void callback(Table table));
|
||||
void create(String tableName, void Function(Table table) callback);
|
||||
|
||||
void createIfNotExists(String tableName, void callback(Table table));
|
||||
void createIfNotExists(String tableName, void Function(Table table) callback);
|
||||
|
||||
void alter(String tableName, void callback(MutableTable table));
|
||||
void alter(String tableName, void Function(MutableTable table) callback);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:angel_orm/angel_orm.dart';
|
||||
import 'package:angel3_orm/angel3_orm.dart';
|
||||
import 'column.dart';
|
||||
|
||||
abstract class Table {
|
||||
MigrationColumn declareColumn(String name, Column column);
|
||||
|
||||
MigrationColumn declare(String name, ColumnType type) =>
|
||||
declareColumn(name, new MigrationColumn(type));
|
||||
declareColumn(name, MigrationColumn(type));
|
||||
|
||||
MigrationColumn serial(String name) => declare(name, ColumnType.serial);
|
||||
|
||||
|
@ -22,7 +22,7 @@ abstract class Table {
|
|||
@deprecated
|
||||
MigrationColumn dateTime(String name) => timeStamp(name, timezone: true);
|
||||
|
||||
MigrationColumn timeStamp(String name, {bool timezone: false}) {
|
||||
MigrationColumn timeStamp(String name, {bool timezone = false}) {
|
||||
if (timezone != true) return declare(name, ColumnType.timeStamp);
|
||||
return declare(name, ColumnType.timeStampWithTimeZone);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ abstract class Table {
|
|||
MigrationColumn varChar(String name, {int? length}) {
|
||||
if (length == null) return declare(name, ColumnType.varChar);
|
||||
return declareColumn(
|
||||
name, new Column(type: ColumnType.varChar, length: length));
|
||||
name, Column(type: ColumnType.varChar, length: length));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
name: angel_migration
|
||||
version: 4.0.0
|
||||
name: angel3_migration
|
||||
version: 4.0.0-beta.1
|
||||
description: Database migration runtime for Angel's ORM. Use this package to define schemas.
|
||||
homepage: https://github.com/dukefirehawk/angel
|
||||
publish_to: none
|
||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/orm/angel_migration
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
dependencies:
|
||||
angel_orm:
|
||||
git:
|
||||
url: https://github.com/dukefirehawk/angel.git
|
||||
ref: sdk-2.12.x_nnbd
|
||||
path: packages/orm/angel_orm
|
||||
angel3_orm: ^4.0.0-beta.1
|
||||
dev_dependencies:
|
||||
pedantic: ^1.11.0
|
||||
|
|
Loading…
Reference in a new issue