package Blib::Dbs::Repocafe ; use strict ; sub init_mods { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'mods' , -tabl => $pref . 'repo_mods' , -pkey => 'mod' , -cafe => $self ) ; $res -> add_col ( -name => 'mod' , -type => 'text' , -uniq => 1 , -null => 0 ) ; $res ; } sub init_repos { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'repos' , -tabl => $pref . 'repos' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'side' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'name' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'ownr' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'publ' , -type => 'bool' , -null => 0 ) ; $res -> add_col ( -name => 'nname' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'creat' , -type => 'date' , -null => 0 ) ; $res -> add_col ( -name => 'dscr' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'lock' , -type => 'bool' , -null => 0 ) ; $res -> add_col ( -name => 'wtch' , -type => 'bool' , -null => 0 ) ; $res ; } sub init_paths { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'paths' , -tabl => $pref . 'repo_paths' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'rid' , -type => 'int' , -null => 0 , -fkey => $self -> repos -> id ) ; $res -> add_col ( -name => 'path' , -type => 'text' , -null => 0 , -def => '' ) ; $res -> add_col ( -name => 'publ' , -type => 'bool' , -null => 0 ) ; $res ; } sub init_rights { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'rights' , -tabl => $pref . 'repo_rights' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'pid' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'rid' , -type => 'int' , -null => 0 , -fkey => $self -> paths -> id ) ; $res -> add_col ( -name => 'mod' , -type => 'text' , -null => 0 , -fkey => $self -> mods -> mod ) ; $res -> add_col ( -name => 'man' , -type => 'bool' , -null => 0 ) ; $res -> add_col ( -name => 'wat' , -type => 'bool' , -null => 0 ) ; $res ; } sub init_guests { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'guests' , -tabl => $pref . 'repo_guests' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'login' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'passwd' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'name' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'email' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'parent' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'creat' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'nwmail' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'nwcode' , -type => 'text' , -null => 0 ) ; $res ; } sub init_stats { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'stats' , -tabl => $pref . 'repo_stats' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'rid' , -type => 'int' , -null => 0 , -fkey => $self -> repos -> id ) ; $res -> add_col ( -name => 'rev' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'size' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'date' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'time' , -type => 'int' , -null => 0 ) ; $res ; } sub init_tots { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'tots' , -tabl => $pref . 'repo_tots' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'size' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'count' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'date' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'time' , -type => 'int' , -null => 0 ) ; $res ; } sub init_groups { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'groups' , -tabl => $pref . 'repo_groups' , -pkey => 'gid' , -cafe => $self ) ; $res -> add_col ( -name => 'gid' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'name' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'ownr' , -type => 'text' , -null => 0 ) ; $res -> add_col ( -name => 'creat' , -type => 'date' , -null => 0 ) ; $res ; } sub init_gr_mem { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'gr_mem' , -tabl => $pref . 'repo_group_members' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'pid' , -type => 'int' , -null => 0 ) ; $res -> add_col ( -name => 'gid' , -type => 'int' , -null => 0 , -fkey => $self -> groups -> gid ) ; $res -> add_col ( -name => 'mem' , -type => 'bool' , -null => 0 ) ; $res -> add_col ( -name => 'man' , -type => 'bool' , -null => 0 ) ; $res ; } sub init_xusers { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'xusers' , -tabl => $pref . 'repo_xusers' , -pkey => 'id' , -cafe => $self ) ; $res -> add_col ( -name => 'id' , -type => 'serial' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'pid' , -type => 'int' , -uniq => 1 , -null => 0 ) ; $res ; } sub init_roots { my $self = shift ; my $pref = shift ; my $res = $self -> add_tab ( -name => 'roots' , -tabl => $pref . 'repo_roots' , -pkey => 'pid' , -cafe => $self ) ; $res -> add_col ( -name => 'pid' , -type => 'text' , -uniq => 1 , -null => 0 ) ; $res -> add_col ( -name => 'actv' , -type => 'bool' , -null => 0 , -def => 0 ) ; $res ; } sub define_tables { my $self = shift ; my $pref = $self -> conf -> db_pref ; $self -> init_mods ( $pref ) ; $self -> init_repos ( $pref ) ; $self -> init_paths ( $pref ) ; $self -> init_rights ( $pref ) ; $self -> init_guests ( $pref ) ; $self -> init_stats ( $pref ) ; $self -> init_tots ( $pref ) ; $self -> init_groups ( $pref ) ; $self -> init_gr_mem ( $pref ) ; $self -> init_xusers ( $pref ) ; $self -> init_roots ( $pref ) ; $self ; } 1 ;