angel_migration_runner 2.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

migration #

A PostgreSQL database migration framework built on Angel's ORM.

2.0.0 #

  • Bump to 2.0.0.

2.0.0-beta.1 #

  • Make reset reverse migrations.

2.0.0-beta.0 #

  • Make reset reverse migrations.

2.0.0-alpha.5 #

  • Support default values for columns.

2.0.0-alpha.4 #

  • Include the names of migration classes when running.

2.0.0-alpha.3 #

  • Run migrations in reverse on rollback.

2.0.0-alpha.2 #

  • Run migrations in reverse on reset.

2.0.0-alpha.1 #

  • Cast Iterables via .cast(), rather than as.

2.0.0-alpha #

  • Dart 2 update.

1.0.0-alpha+5 #

Schema#drop now has a named cascade parameter, of type bool.

1.0.0-alpha+1 #

  • You can now pass a connected parameter.

example/main.dart

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:postgres/postgres.dart';
import '../../angel_migration/example/todo.dart';

var migrationRunner = new PostgresMigrationRunner(
  new PostgreSQLConnection('127.0.0.1', 5432, 'test',
      username: 'postgres', password: 'postgres'),
  migrations: [
    new UserMigration(),
    new TodoMigration(),
    new FooMigration(),
  ],
);

main(List<String> args) => runMigrations(migrationRunner, args);

class FooMigration extends Migration {
  @override
  void up(Schema schema) {
    schema.create('foos', (table) {
      table
        ..serial('id').primaryKey()
        ..varChar('bar', length: 64)
        ..timeStamp('created_at').defaultsTo(currentTimestamp);
    });
  }

  @override
  void down(Schema schema) => schema.drop('foos');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_migration_runner: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:angel_migration_runner/angel_migration_runner.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Dec 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:angel_migration_runner/angel_migration_runner.dart.

Health issues and suggestions

Document public APIs. (-0.38 points)

46 out of 47 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/postgres/table.dart. (-7.24 points)

Analysis of lib/src/postgres/table.dart reported 15 hints, including:

line 10 col 7: DO use curly braces for all flow control structures.

line 12 col 7: DO use curly braces for all flow control structures.

line 16 col 15: Unnecessary new keyword.

line 23 col 9: DO use curly braces for all flow control structures.

line 42 col 7: DO use curly braces for all flow control structures.

Fix lib/src/cli.dart. (-2.48 points)

Analysis of lib/src/cli.dart reported 5 hints:

line 7 col 13: Unnecessary new keyword.

line 8 col 18: Unnecessary new keyword.

line 9 col 18: Unnecessary new keyword.

line 10 col 18: Unnecessary new keyword.

line 11 col 18: Unnecessary new keyword.

Fix lib/src/postgres/runner.dart. (-2.48 points)

Analysis of lib/src/postgres/runner.dart reported 5 hints:

line 12 col 44: Unnecessary new keyword.

line 16 col 65: Use = to separate a named parameter from its default value.

line 66 col 22: Unnecessary new keyword.

line 97 col 22: Unnecessary new keyword.

line 121 col 22: Unnecessary new keyword.

Fix lib/src/postgres/schema.dart. (-2.48 points)

Analysis of lib/src/postgres/schema.dart reported 5 hints:

line 12 col 31: Unnecessary new keyword.

line 12 col 52: Unnecessary new keyword.

line 27 col 44: Use = to separate a named parameter from its default value.

line 34 col 15: Unnecessary new keyword.

line 43 col 15: Unnecessary new keyword.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (postgres).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
angel_migration ^2.0.0-alpha 2.0.0
angel_orm ^2.0.0-dev.2 2.0.2 2.1.0-beta.3
args ^1.0.0 1.5.2
charcode ^1.0.0 1.1.2
postgres >=0.9.5 <2.0.0 1.0.2 2.1.0
Transitive dependencies
collection 1.14.12
convert 2.1.1
crypto 2.1.4
intl 0.15.8 0.16.0
meta 1.1.8
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6