NAME

Oryx::Schema - Schema class for Oryx

SYNOPSIS

  package CMS::Schema;
 
  # enable auto deploy for all classes 
  use Oryx::Class(auto_deploy => 1);
   
  # useful if you want to say $storage->deploySchema('CMS::Schema');
  use CMS::Page;
  use CMS::Paragraph;
  use CMS::Image;
  use CMS::Author;
   
  sub prefix { 'cms' }

  1;

  #==================================================================
  # ALTERNATIVE - With XML::DOM::Lite installed
  #==================================================================
  package CMS::Schema;
  use base qw(Oryx::Schema);
  1;
  __DATA__
  <Schema>
    <Class name="CMS::Page">
      <Attribute name="title" type="String"/>
      <Attribute name="num" type="Integer"/>
      <Association role="author" class="CMS::Author"/>
    </Class>
    <Class name="CMS::Author">
      <Attribute name="first_name" type="String"/>
      <Attribute name="last_name" type="String"/>
    </Class>
  </Schema>
  use CMS::Schema;
   
  my $cms_storage = Oryx->connect(\@conn, 'CMS::Schema'); 
  CMS::Schema->addClass('CMS::Revision');
  my @cms_classes = CMS::Schema->classes;
  $cms_storage->deploySchema();                 # deploys only classes seen by CMS::Schema
  $cms_storage->deploySchema('CMS::Schema')     # same thing, but `use's CMS::Schema first
  my $name = CMS::Schema->name;                 # returns CMS_Schema
  CMS::Schema->hasClass($classname);            # true if seen $classname
  

DESCRIPTION

Schema class for Oryx.

The use of this class is optional.

The intention is to allow arbitrary grouping of classes into different namespaces to support simultaneous use of different storage backends, or for having logically separate groups of classes in the same database, but having table names prefixed to provide namespace separation.

SEE ALSO

Oryx, Oryx::Class

AUTHOR

Copyright (C) 2005 Richard Hundt <richard NO SPAM AT protea-systems.com>

LICENSE

This library is free software and may be used under the same terms as Perl itself.