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

Database migration runtime for Angel3 ORM. Use this package to define schemas.

example/main.dart

/// These are straightforward migrations.
///
/// You will likely never have to actually write these yourself.
library angel3_migration.example.todo;

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');
  }
}
0
likes
130
pub points
63%
popularity

Publisher

verified publisherdukefirehawk.com

Database migration runtime for Angel3 ORM. Use this package to define schemas.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

angel3_orm

More

Packages that depend on angel3_migration