Updated migration_runner
This commit is contained in:
parent
88bdabc5c9
commit
e5036e734f
6 changed files with 57 additions and 14 deletions
|
@ -1,21 +1,21 @@
|
|||
import 'package:angel_migration/angel_migration.dart';
|
||||
import 'package:angel_migration_runner/angel_migration_runner.dart';
|
||||
import 'package:angel_migration_runner/postgres.dart';
|
||||
import 'package:angel_orm/angel_orm.dart';
|
||||
import 'package:angel3_migration/angel3_migration.dart';
|
||||
import 'package:angel3_migration_runner/angel3_migration_runner.dart';
|
||||
import 'package:angel3_migration_runner/postgres.dart';
|
||||
import 'package:angel3_orm/angel3_orm.dart';
|
||||
import 'package:postgres/postgres.dart';
|
||||
import '../../angel_migration/example/todo.dart';
|
||||
import 'todo.dart';
|
||||
|
||||
var migrationRunner = new PostgresMigrationRunner(
|
||||
new PostgreSQLConnection('127.0.0.1', 5432, 'test',
|
||||
var migrationRunner = PostgresMigrationRunner(
|
||||
PostgreSQLConnection('127.0.0.1', 5432, 'test',
|
||||
username: 'postgres', password: 'postgres'),
|
||||
migrations: [
|
||||
new UserMigration(),
|
||||
new TodoMigration(),
|
||||
new FooMigration(),
|
||||
UserMigration(),
|
||||
TodoMigration(),
|
||||
FooMigration(),
|
||||
],
|
||||
);
|
||||
|
||||
main(List<String> args) => runMigrations(migrationRunner, args);
|
||||
void main(List<String> args) => runMigrations(migrationRunner, args);
|
||||
|
||||
class FooMigration extends Migration {
|
||||
@override
|
||||
|
|
40
packages/orm/angel_migration_runner/example/todo.dart
Normal file
40
packages/orm/angel_migration_runner/example/todo.dart
Normal file
|
@ -0,0 +1,40 @@
|
|||
/// These are straightforward migrations.
|
||||
///
|
||||
/// You will likely never have to actually write these yourself.
|
||||
import 'package:angel3_migration/angel3_migration.dart';
|
||||
|
||||
class UserMigration implements Migration {
|
||||
@override
|
||||
void up(Schema schema) {
|
||||
schema.create('users', (table) {
|
||||
table
|
||||
..serial('id').primaryKey()
|
||||
..varChar('username', length: 32).unique()
|
||||
..varChar('password')
|
||||
..boolean('account_confirmed').defaultsTo(false);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void down(Schema schema) {
|
||||
schema.drop('users');
|
||||
}
|
||||
}
|
||||
|
||||
class TodoMigration implements Migration {
|
||||
@override
|
||||
void up(Schema schema) {
|
||||
schema.create('todos', (table) {
|
||||
table
|
||||
..serial('id').primaryKey()
|
||||
..integer('user_id').references('users', 'id').onDeleteCascade()
|
||||
..varChar('text')
|
||||
..boolean('completed').defaultsTo(false);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void down(Schema schema) {
|
||||
schema.drop('todos');
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
# 3.0.2
|
||||
* Resolved static analysis warnings
|
||||
|
||||
# 3.0.1
|
||||
* Resolved static analysis warnings
|
||||
# 3.0.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# angel3_pub_sub
|
||||
[![version](https://img.shields.io/badge/pub-v3.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_pub_sub)
|
||||
[![version](https://img.shields.io/badge/pub-v3.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_pub_sub)
|
||||
[![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)
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ class _IsolateClientSubscription extends ClientSubscription {
|
|||
}
|
||||
|
||||
@override
|
||||
StreamSubscription listen(void onData(event)?,
|
||||
StreamSubscription listen(void Function(dynamic event)? onData,
|
||||
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
|
||||
return _stream.stream.listen(onData,
|
||||
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_pub_sub
|
||||
version: 3.0.1
|
||||
version: 3.0.2
|
||||
description: Keep application instances in sync with a simple pub/sub API.
|
||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/pub_sub
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue