EPrints Technical Mailing List Archive

Message: #07555


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Reset an archive before going live



Il 01/11/18 19:12, John Salter via Eprints-tech ha scritto:
Hi Yuri,
Have you configured any metadata field via the web interface? [SELECT COUNT(*) FROM mf;].

Hi John!

MariaDB [myserver]> SELECT COUNT(*) FROM mf;
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

I've customized only phrases and templates and added some fields.

If you haven't, then I think these steps:
Bin/export subjects
bin/epadmin erase_data
bin/epadmin create_db
import subjects

Uhm


     erase_data

  epadmin erase_data repository_id

Erases and recreates the database. Removes all documents and files. Does not touch the configuration files.

It already recreate the database, why should I run "epadmin create_db"?

You could either:
- create a copy of the epadmin script, and add the 'user' dataset to the erase_eprints datasets
or
- manually remove all user* tables from the database, and then run:
UPDATE counters SET counter=0 WHERE countername = userid;

I think this is the safer way.

Then run:
bin/epadmin update ARCHIVEID
which I *think* should create all the tables necessary.

Why create the tables? They're already there and clear_table just do a delete:

sub clear_table
{
    my( $self, $tablename ) = @_;

    my $sql = "DELETE FROM ".$self->quote_identifier($tablename);
    $self->do( $sql );
}

The tablename came from a match of the table name with the datasetid on reset_dataset:

    foreach my $table ( @tables )
    {
        next unless( $table =~ m/^$datasetid/ );
        print "Erasing table $table\n" if( $noise >= 2 );
        $db->clear_table($table);
    }