Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package MyApp::Schema;
  2. sub new_schema {
  3. __PACKAGE__->connect(...)
  4. }
  5.  
  6. package MyCatApp::Model::MyApp;
  7. use Moose;
  8. extends 'Catalyst::Model::DBIC::Schema';
  9.  
  10. ## what here;
  11.  
  12. _PACKAGE__->make_immutable;
  13.  
  14. <Model::MyApp>
  15. schema_class MyApp::Schema
  16. traits Caching
  17. user_defined_schema_accessor foo
  18. </Model::MyApp>
  19.  
  20. __PACKAGE__->config('schema_class', MyApp::Schema->new_schema)
  21.  
  22. __PACKAGE__->config('schema_class', MyApp::Schema->new_schema)
  23.  
  24. subtype SchemaClass,
  25. as LoadableClass,
  26. where { $_->isa('DBIx::Class::Schema') };
  27.  
  28. has schema_class => (
  29. is => 'ro',
  30. isa => 'Object',
  31. required => 1
  32. );
  33.  
  34. __PACKAGE__->config(
  35. schema_class => 'MyApp::Schema',
  36. connect_info => {
  37. dsn => 'dbi:Pg:dbname=mypgdb',
  38. user => 'postgres',
  39. password => '',
  40. pg_enable_utf8 => 1,
  41. on_connect_do => [
  42. 'some SQL statement',
  43. 'another SQL statement',
  44. ],
  45. }
  46. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement