diff options
Diffstat (limited to 'lib/githubexplorer/Schema/Result')
-rw-r--r-- | lib/githubexplorer/Schema/Result/Follow.pm | 18 | ||||
-rw-r--r-- | lib/githubexplorer/Schema/Result/Profiles.pm | 28 | ||||
-rw-r--r-- | lib/githubexplorer/Schema/Result/Repositories.pm | 23 |
3 files changed, 69 insertions, 0 deletions
diff --git a/lib/githubexplorer/Schema/Result/Follow.pm b/lib/githubexplorer/Schema/Result/Follow.pm new file mode 100644 index 0000000..735980b --- /dev/null +++ b/lib/githubexplorer/Schema/Result/Follow.pm @@ -0,0 +1,18 @@ +package githubexplorer::Schema::Result::Follow; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('follow'); + +__PACKAGE__->add_columns( + id_follower => { data_type => 'int', }, + id_following => { data_type => 'int' }, +); +__PACKAGE__->set_primary_key(qw/id_follower id_following/); +__PACKAGE__->belongs_to( 'id_follower', + 'githubexplorer::Schema::Result::Profiles' ); +__PACKAGE__->belongs_to( 'id_following', + 'githubexplorer::Schema::Result::Profiles' ); + +1; diff --git a/lib/githubexplorer/Schema/Result/Profiles.pm b/lib/githubexplorer/Schema/Result/Profiles.pm new file mode 100644 index 0000000..001057e --- /dev/null +++ b/lib/githubexplorer/Schema/Result/Profiles.pm @@ -0,0 +1,28 @@ +package githubexplorer::Schema::Result::Profiles; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('profiles'); +__PACKAGE__->add_columns( + id => { data_type => 'integer', }, + login => { data_type => 'varchar' }, + blog => { data_type => 'varchar', is_nullable => 1 }, + company => { data_type => 'varchar', is_nullable => 1 }, + created_at => { data_type => 'timestamp' }, + email => { data_type => 'varchar', is_nullable => 1 }, + followers_count => { data_type => 'int' }, + following_count => { data_type => 'int' }, + gravatar_id => { data_type => 'varchar', is_nullable => 1 }, + location => { data_type => 'varchar', is_nullable => 1 }, + name => { data_type => 'varchar', is_nullable => 1 }, + public_gist_count => { data_type => 'int' }, + public_repo_count => { data_type => 'int' }, + depth => { data_type => 'boolean' }, +); + +__PACKAGE__->set_primary_key('id'); +__PACKAGE__->has_many( 'get_repos', + 'githubexplorer::Schema::Result::Repositories', 'id_profile' ); + +1; diff --git a/lib/githubexplorer/Schema/Result/Repositories.pm b/lib/githubexplorer/Schema/Result/Repositories.pm new file mode 100644 index 0000000..641305f --- /dev/null +++ b/lib/githubexplorer/Schema/Result/Repositories.pm @@ -0,0 +1,23 @@ +package githubexplorer::Schema::Result::Repositories; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/Core/); +__PACKAGE__->table('repositories'); +__PACKAGE__->add_columns( + id => { data_type => 'integer', is_auto_increment => 1 }, + description => { data_type => 'text', is_nullable => 1 }, + name => { data_type => 'varchar' }, + homepage => { data_type => 'varchar', is_nullable => 1 }, + url => { data_type => 'varchar', is_nullable => 1 }, + watchers => { data_type => 'int' }, + forks => { data_type => 'int' }, + id_profile => { data_type => 'int', is_foreign_key => 1 }, +); + +__PACKAGE__->set_primary_key('id'); +__PACKAGE__->belongs_to( 'id_profile', + 'githubexplorer::Schema::Result::Profiles' ); +__PACKAGE__->add_unique_constraint( [qw/name id_profile/] ); + +1; |