File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+ use warnings;
4
+ use strict;
5
+
6
+ use DBI ();
7
+ use ADBOS::Schema;
8
+ use ADBOS::DB;
9
+ use ADBOS::Config;
10
+
11
+ my $config = simple_config;
12
+ my $db = ADBOS::DB-> new($config );
13
+
14
+ my $signals_rs = $db -> sch-> resultset(' Signal' );
15
+ my @signals = $signals_rs -> search({sigtype => undef })-> all;
16
+ my @sigtypes = $db -> sch-> resultset(' Sigtype' )-> search({search => 1})-> all;
17
+
18
+ for my $sig (@signals )
19
+ {
20
+
21
+ printf " Trying %s \n " , $sig -> id;
22
+
23
+ my $text = $sig -> content;
24
+ $text =~ s /\r *// g ;
25
+
26
+ if (my $sigtype = $db -> sigtypeSearch($text ))
27
+ {
28
+ printf (" Updating signal type to %s for signal ID %s \n " , $sigtype , $sig -> id);
29
+ my $sigtype_rs = $sch -> resultset(' Sigtype' );
30
+ my $type = $sigtype_rs -> find($sigtype , { key => ' name' }) if $sigtype ;
31
+ $sig -> update({ sigtype => $type -> id });
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments