Revision 547

Date:
2016/02/12 12:00:21
Author:
ahitrov
Revision Log:
Tag parent id (pid) and level fields
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/tag/lib/tag/SQL/TagsTable.pm

     
    65 65 }
    66 66
    67 67 ########### FILTERS DESCRIPTION ####################################################################################
    68 sub _get_orders {
    69 my ($self, %opts) = @_;
    70
    71 if ($opts{order_by}) {
    72 return ' order by '.$opts{order_by};
    73 } else {
    74 return ' order by name';
    75 }
    76 return undef;
    77 }
    78
    68 79 sub _s_filter {
    69 80 my ($self,%opts)=@_;
    70 return undef unless ( exists $opts{s} );
    81 return undef unless ( exists $opts{s} && defined $opts{s} );
    71 82 return &SQL::Common::_generic_int_filter('d.sections', $opts{s});
    72 83 }
    73 84
     
    136 147 }
    137 148 }
    138 149
    150 # Связь с определенным документ(ом/тами) по классам линка
    151 if ( exists $opts{ldestclass} ) {
    152 my ($where, $values) = SQL::Common::_generic_text_filter('l.dest_class', $opts{ldestclass});
    153 push (@wheres, $where);
    154 push (@binds, ref($values) ? @$values:$values) if (defined $values);
    155
    156 return (\@wheres, \@binds, " join $link_table as l on l.source_id=d.id and l.source_class=d.class");
    157 }
    158
    159
    139 160 return (undef);
    140 161 }
    141 162
  • utf8/plugins/tag/sql/TOAST/tags-update.484.sql

     
    1 alter table tags add column pid integer default 0;
    2 alter table tags add column level integer default 1;
    3 create index tags_pid on tags (pid);
  • utf8/plugins/tag/sql/TOAST/tags.sql

     
    6 6 class text not null,
    7 7 status smallint not null default 0,
    8 8 sections integer,
    9 pid integer default 0,
    10 level integer default 1,
    9 11 name text,
    10 12 alias text,
    11 13 data text
    12 14 );
    13 15 create index tags_name on tags (name);
    14 16 create index tags_alias on tags (alias) WHERE alias IS NOT NULL AND alias != '';
    17 create index tags_pid on tags (pid);