diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2d2a7e5daf72e1bdee2b7e3322922cf170adc5bc..e064608675c5073b6bdf5365f4581b5fbda76bd7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:19.03.12
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  IMAGE_VER: 1.6.0
+  IMAGE_VER: 1.7.0
 
 services:
   - docker:19.03.12-dind
diff --git a/script/index_records b/script/index_records
new file mode 100755
index 0000000000000000000000000000000000000000..0d7aec29c2afb7c1f199c0143690e772042849fe
--- /dev/null
+++ b/script/index_records
@@ -0,0 +1,46 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin qw($Bin);
+use lib "$Bin/../lib";
+use File::Copy;
+
+use constant YAMDI => '/usr/bin/yamdi';
+
+#use PiTube::Schema;
+use Mojo::Pg;
+
+my $pg = Mojo::Pg->new
+    ->dsn($ENV{DB_DSN})
+    ->username($ENV{DB_USERNAME})
+    ->password($ENV{DB_PASSWORD})
+;
+
+my $records = $pg->db->query(qq[
+    select id,path from records
+    where not is_indexed
+    and path <> ''
+]);
+
+RECORD:
+while (my $record = $records->hash) {
+    next RECORD if ! -f $record->{path};
+
+    print "Indexing $record->{path}\n";
+
+    system(YAMDI, '-i', $record->{path}, '-o', $record->{path} . '.idx' );
+
+    if ($?) {
+        print "ERROR $!\n";
+    }
+    else {
+        move($record->{path} . '.idx', $record->{path});
+        $pg->db->update(
+            'records',
+            {is_indexed => 't'},
+            {id => $record->{id}},
+        );
+    }
+
+}