summary refs log tree commit diff
path: root/lib/githubexplorer/Schema/Result/Repositories.pm
blob: 58c0e51b6e465e058b2c1b24e292b4270e7dc9d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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' },
    fork        => { data_type => 'bool' },
    id_profile  => { data_type => 'int',     is_foreign_key    => 1 },
);

__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;