needle_orm_migration 0.1.1 copy "needle_orm_migration: ^0.1.1" to clipboard
needle_orm_migration: ^0.1.1 copied to clipboard

ORM migration for Needle ORM, and ORM framework inspired by Ebean.io (an excellent ORM from Java/Kotlin world).

example/main.dart

import 'package:needle_orm_migration/needle_orm_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
120
pub points
0%
popularity

Publisher

verified publisherhsdcloud.cn

ORM migration for Needle ORM, and ORM framework inspired by Ebean.io (an excellent ORM from Java/Kotlin world).

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

analyzer, inflection3, logging, needle_orm, recase, source_gen

More

Packages that depend on needle_orm_migration