• Dev
  • Importing from PHPBB to Flarum

So I'm here trying to import some data over from phpbb to flarum and I get this error: Duplicate entry 'sometext' for key 'tags_slug_unique'

Example data:

INSERT INTO tags (id, name, description, slug, color, position) VALUES 
	(37, 'Geral', '', 'geral', '#d7d520', 1),
	(38, 'รrea Tรฉcnica', '', 'n-a', '#066b01', 2),

I'm not really savvy in MySQL so I need some help with this one. Google searches didn't show anything useful.

Well the error message says Duplicate entry so when you try to INSERT INTO tags, there probably already exists a tag with a primary id slug of 37, 38, etc. That's the behavior you'd want to happen - since inserting information with a id slug of 37 when there is already something there in the id slug 37 slot will cause the original data to become corrupted or lost.

If you want to force your new ids slugs to replace the old ones (at the cost of possible corruption / loss of data), you can switch INSERT with REPLACE.


That all being said, I have very limited mysql experience, so it'd be wise to wait for someone more familiar with it. Good luck!

It's the slug, not the ID.

    It is on a fresh flarum install. Not even one post made.

    Franz how do you mean?

      VIRUXE the slug value of your import has a duplicate. So you are trying to import a tag with a slug that already exists in your database. That is causing the error. Also I recommend dropping the ID in your import, the database has its own mechanism to increment that ID value, unless you want to prevent duplicates.

        luceos Also I recommend dropping the ID in your import, the database has its own mechanism to increment that ID value, unless you want to prevent duplicates.

        I thought about that but iirc it needs those ids in order to link all the imported discussions together. I'm trying to convert basicly everything that matters over from PhpBB to Flarum.

        I've already managed to import everything but the tags but I still need to figure out what Flarum does with each of its table fields in order to export all the data correctly. It's still a work in progress. ๐Ÿ™‚

          VIRUXE that makes sense ๐Ÿ˜‰ You can disregard my comment in that situation.

          Silly me I just realized my import script threw out duplicate values for the slug field because some categories in PHPBB didn't have a slug. I have yet to test if this is the issue so I will report back once tested.

          Yes. I have confirmed that was the issue. Flarum requires a unique slug every time. Fixed.