diff options
Diffstat (limited to 'lib/githubexplorer/Schema')
-rw-r--r-- | lib/githubexplorer/Schema/Result/Fork.pm | 29 | ||||
-rw-r--r-- | lib/githubexplorer/Schema/Result/Language.pm | 12 | ||||
-rw-r--r-- | lib/githubexplorer/Schema/Result/RepoLang.pm | 20 | ||||
-rw-r--r-- | lib/githubexplorer/Schema/Result/Repositories.pm | 4 |
4 files changed, 65 insertions, 0 deletions
diff --git a/lib/githubexplorer/Schema/Result/Fork.pm b/lib/githubexplorer/Schema/Result/Fork.pm new file mode 100644 index 0000000..195c1f9 --- /dev/null +++ b/lib/githubexplorer/Schema/Result/Fork.pm @@ -0,0 +1,29 @@ +package githubexplorer::Schema::Result::Fork; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('fork'); + +__PACKAGE__->add_columns( + profile_origin => { data_type => 'int', }, + profile_dest => { data_type => 'int' }, + repo_origin => { data_type => 'int' }, + repo_dest => { data_type => 'int' }, +); + +__PACKAGE__->set_primary_key( + qw/repo_origin repo_dest profile_origin profile_dest/ ); + +__PACKAGE__->belongs_to( 'profile_origin', + 'githubexplorer::Schema::Result::Profiles' ); +__PACKAGE__->belongs_to( 'profile_dest', + 'githubexplorer::Schema::Result::Profiles' ); + +__PACKAGE__->belongs_to( 'repo_origin', + 'githubexplorer::Schema::Result::Repositories' ); +__PACKAGE__->belongs_to( 'repo_dest', + 'githubexplorer::Schema::Result::Repositories' ); + +1; + diff --git a/lib/githubexplorer/Schema/Result/Language.pm b/lib/githubexplorer/Schema/Result/Language.pm new file mode 100644 index 0000000..2bfe23c --- /dev/null +++ b/lib/githubexplorer/Schema/Result/Language.pm @@ -0,0 +1,12 @@ +package githubexplorer::Schema::Result::Language; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('languages'); + +__PACKAGE__->add_columns( name => { data_type => 'varchar' }, ); + +__PACKAGE__->set_primary_key('name'); + +1; diff --git a/lib/githubexplorer/Schema/Result/RepoLang.pm b/lib/githubexplorer/Schema/Result/RepoLang.pm new file mode 100644 index 0000000..4fce474 --- /dev/null +++ b/lib/githubexplorer/Schema/Result/RepoLang.pm @@ -0,0 +1,20 @@ +package githubexplorer::Schema::Result::RepoLang; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('repolang'); + +__PACKAGE__->add_columns( + repository => { data_type => 'int', }, + language => { data_type => 'varchar', }, + size => { data_type => 'int' }, +); + +__PACKAGE__->set_primary_key(qw/repository language/); +__PACKAGE__->belongs_to( 'repository', + 'githubexplorer::Schema::Result::Repositories' ); +__PACKAGE__->belongs_to( 'language', + 'githubexplorer::Schema::Result::Language' ); + +1; diff --git a/lib/githubexplorer/Schema/Result/Repositories.pm b/lib/githubexplorer/Schema/Result/Repositories.pm index 2bd7136..58c0e51 100644 --- a/lib/githubexplorer/Schema/Result/Repositories.pm +++ b/lib/githubexplorer/Schema/Result/Repositories.pm @@ -17,8 +17,12 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key('id'); + __PACKAGE__->belongs_to( 'id_profile', 'githubexplorer::Schema::Result::Profiles' ); +__PACKAGE__->has_many( 'get_languages', + 'githubexplorer::Schema::Result::RepoLang', 'language' ); + __PACKAGE__->add_unique_constraint( [qw/name id_profile/] ); 1; |