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:angel3_migration/angel3_migration.dart';
|
||||||
import 'package:angel_migration_runner/angel_migration_runner.dart';
|
import 'package:angel3_migration_runner/angel3_migration_runner.dart';
|
||||||
import 'package:angel_migration_runner/postgres.dart';
|
import 'package:angel3_migration_runner/postgres.dart';
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel3_orm/angel3_orm.dart';
|
||||||
import 'package:postgres/postgres.dart';
|
import 'package:postgres/postgres.dart';
|
||||||
import '../../angel_migration/example/todo.dart';
|
import 'todo.dart';
|
||||||
|
|
||||||
var migrationRunner = new PostgresMigrationRunner(
|
var migrationRunner = PostgresMigrationRunner(
|
||||||
new PostgreSQLConnection('127.0.0.1', 5432, 'test',
|
PostgreSQLConnection('127.0.0.1', 5432, 'test',
|
||||||
username: 'postgres', password: 'postgres'),
|
username: 'postgres', password: 'postgres'),
|
||||||
migrations: [
|
migrations: [
|
||||||
new UserMigration(),
|
UserMigration(),
|
||||||
new TodoMigration(),
|
TodoMigration(),
|
||||||
new FooMigration(),
|
FooMigration(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
main(List<String> args) => runMigrations(migrationRunner, args);
|
void main(List<String> args) => runMigrations(migrationRunner, args);
|
||||||
|
|
||||||
class FooMigration extends Migration {
|
class FooMigration extends Migration {
|
||||||
@override
|
@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
|
# 3.0.1
|
||||||
* Resolved static analysis warnings
|
* Resolved static analysis warnings
|
||||||
# 3.0.0
|
# 3.0.0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# angel3_pub_sub
|
# angel3_pub_sub
|
||||||
[](https://pub.dartlang.org/packages/angel3_pub_sub)
|
[](https://pub.dartlang.org/packages/angel3_pub_sub)
|
||||||
[](https://dart.dev/null-safety)
|
[](https://dart.dev/null-safety)
|
||||||
[](https://gitter.im/angel_dart/discussion)
|
[](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ class _IsolateClientSubscription extends ClientSubscription {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamSubscription listen(void onData(event)?,
|
StreamSubscription listen(void Function(dynamic event)? onData,
|
||||||
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
|
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
|
||||||
return _stream.stream.listen(onData,
|
return _stream.stream.listen(onData,
|
||||||
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel3_pub_sub
|
name: angel3_pub_sub
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
description: Keep application instances in sync with a simple pub/sub API.
|
description: Keep application instances in sync with a simple pub/sub API.
|
||||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/pub_sub
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/pub_sub
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue