This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 22nd, 2012  |  syntax: None  |  size: 0.60 KB  |  views: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. use strict;
  2. use warnings;
  3. use Test::More tests => 1;
  4. use Data::Model;
  5. use Data::Model::Driver::DBI;
  6.  
  7. {
  8.   package Neko::DB::User;
  9.   use base 'Data::Model';
  10.   use Data::Model::Schema;
  11.  
  12.   install_model user => schema {
  13.       key 'foo';
  14.  
  15.       column 'foo' => varchar => {
  16.         binary => 1,
  17.       };
  18.   };
  19. }
  20.  
  21. my $dm = Neko::DB::User->new();
  22. my $driver = Data::Model::Driver::DBI->new(
  23.     dsn => 'dbi:SQLite:'
  24. );
  25. $dm->set_base_driver($driver);
  26.  
  27. for my $target ($dm->schema_names) {
  28.     for my $sql ($dm->as_sqls($target)) {
  29.         $driver->rw_handle->do($sql);
  30.     }
  31. }
  32.  
  33. ok 1;
clone this paste RAW Paste Data