migrable 0.2.1

  • Readme
  • Changelog
  • Installing
  • 44

migrable #

pub.dev

A easy way to build Flutter migrations.

The idea is to separate each of the scripts into a single migration file. Just like we do in other languages like PHP and C#. This is good for organizing the code as well as making it responsible.

So far we are only able to work with sqflite. If you want and can use it, see more about here.

We are using sqflitecon for connection management. If you don't know it yet, see more here.

Usage #

Creating migrations #

Create a Dart class in a reserved to migrations folder - like database/migrations or just migrations - and make it looks like that:

import 'package:migrable/migration.dart';
import 'package:sqflite/sqflite.dart';

class YourMigrationName implements Migration {
  @override
  void up(Batch batch) {
    batch.execute('YOUR MIGRATION SCRIPT');
  }
}

Migrating #

To call the execution of your migrations scripts include a section like that:

import 'package:migrable/migrable.dart';
import 'package:migrable/migration.dart';

List<Migration> migrations = [
    // Instances of your migration classes.
];

Migrable.execute(migrations);

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased] #

[0.2.1] - 2020-01-01 #

Fixed: #

  • Unable to execute when migration list is empty.

[0.2.0] - 2020-01-01 #

Added: #

[0.1.0] - 2019-12-30 #

Added: #

  • New connection management using sqflitecon.
  • Documentation rewrite with improvements.

[0.0.2] - 2019-12-30 #

Fixed: #

  • Invalid migration class name.

[0.0.1] - 2019-12-22 #

First version with initial source code.

Use this package as a library

1. Depend on it

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


dependencies:
  migrable: ^0.2.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:migrable/migrable.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

8 out of 8 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.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and migrable.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
sqflite ^1.2.0 1.3.0
sqflitecon ^1.1.0 1.1.0
Transitive dependencies
collection 1.14.11 1.14.12
flutter_dotenv 2.1.0
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
sqflite_common 1.0.0+1
synchronized 2.2.0
typed_data 1.1.6
vector_math 2.0.8