Changing numbering of articles

Is it possible to change the numbering of articles?
We have tested our installation of OJS so now the last test article has number 35. Soon we would like to submit “real” articles starting from 4-digit number because we don’t want to change our current numbering.
How can we do this?

Thank you very much, AS

1 Like

Would you be willing to use non-numeric identifiers for your OJS articles? For example, it could be as simple as prefixing a character like “a4761”. If so, you can use the custom “Public Identifier” for the article. You can find this under User Home → Editor → (Select an Issue)

Each article in the Table of Contents will allow you to select a public identifier, but strictly numeric identifiers should be reserved for internal OJS use.

1 Like

We use numeric identifiers for our articles and we would like not to change this numbering.

For example, one of our last submitted articles has number 3750.
We would like to have this number as the first part of the name of the file in our OJS when we submit it through OJS: for example, 3750–xx-x-SM.PDF (x is given by OJS)
and for next articles 3751-…, 3752-…, and so on.

How can I do this?

Thank you very much, AS.

These numbers are a serial index provided by the database server. It is possible that you could manually fast-forward the index to the ID you are wanting, but ultimately you will have very little control over the numbering. For example, the index is shared across journals and will include both accepted and rejected articles.

If those constraints are acceptable, I briefly tested resetting the mysql index on the my articles table via:

insert into ojs_database.articles (article_id) values (9999);
delete from ojs_database.articles where article_id = 9999;

Then I used the QuickSubmit plugin to add a new unpublished article, which became submission number 10000.

Thank you very much for your answer.
What about other tables which contain column article_id? I found 12 such tables:
article_comments |
article_files
article_galleys
article_search_objects
article_settings
article_supplementary_files
article_xml_galleys |
books_for_review
edit_assignments
edit_decisions
published_articles
referrals .
Do I need to insert the new value of index to all of them (like you did in in the table articles) ?
AS

No, you don’t need to touch the other tables.

By manually acting on the articles table’s article_id, you are resetting the primary key index. All the foreign keys in the other tables will reference the primary key for any newly created primary key values.

Thank you very much. This could be a solution to our problem.

But I wonder whether it can be done using some MySQL commands:
setting new value of a number of our article (UPDATE article_id) in articles table and using ON UPDATE CASCADE in tables where article_id is a foreign key.
I do not know how to do it properly.

AS

Are you talking about doing this for new articles, or for existing articles?

The single UPDATE / DELETE to reset the articles.article_id index will work for new articles.

Cascading update to the foreign key would be required for changing existing article ids, but that would require advanced knowledge of mysql and of the table structure. Some foreign keys are shared (context_id) and would make this extremely difficult.

Thank you once more.

Our last test article has number 40.

Can I use this MySQL command:
UPDATE articles SET article_id=3749 WHERE article_id=40;

to have the next (real) submitted article assigned (by the system) number 3750?
Is the field article_id updateable?
If not, how to do this using UPDATE statement?

AS

No, you do not want to use the UPDATE command. You want to insert a new article_id of 3749, and then delete it. This will reset the index to the next available sequence number of 3750. Check this previous post again:

1 Like

I have one more question concerning changing numbering of articles in the OJS database.

Can I use this MySQL statement to set new value for article_id:

ALTER TABLE articles AUTO_INCREMENT=3750;

to have for new submitted article number 3750 (when the last test article in our database has number 40).
Or perhaps it has to be number 3749 (instead of 3750)

Thank you very much for help.

AS

Hi @ania,

Yes, that should work – I believe 3750 would be correct rather than 3749.

Regards,
Alec Smecher
Public Knowledge Project Team