Skip to main content

angel3_migration 10.0.0 copy "angel3_migration: ^10.0.0" to clipboard
angel3_migration: ^10.0.0 copied to clipboard

The abstract classes for implementing database migration in Angel3 framework. Designed to work with Angel3 ORM.

example/main.dart

/*
  These are straightforward migrations.
  You will likely never have to actually write these yourself.
*/
import 'package:angel3_migration/angel3_migration.dart';

class UserMigration extends 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 extends 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
likes
160
points
816
downloads

Documentation

API reference

Publisher

verified publisherdukefirehawk.com

Weekly Downloads

The abstract classes for implementing database migration in Angel3 framework. Designed to work with Angel3 ORM.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

BSD-3-Clause (license)

Dependencies

angel3_orm

More

Packages that depend on angel3_migration