Importing Apple Wiki – error 27 when running wikiadmin command

osx-serverserver.appserveradmin

I exported Apple Wiki data on an Apple server running 10.10 using the command 'wikiadmin'. It exported successfully.

I copied the exported data over to a new Apple 10.13 server and am trying to use wikiadmin import to import the data.

I'm getting this error:

    sh-3.2# wikiadmin import -all -path /private/tmp/wikiexport

Converted requested path /private/tmp/wikiexport to absolute path /tmp/wikiexport
        Found Exported.wikis contained in /tmp/wikiexport
        Import path is a recognized Wiki export bundle
        requestedWikiName b25a226e-6c1e-4664-a114-7002b29d3fee is a guid
        Wikis to import: 1
        Importing from /tmp/wikiexport/Exported.wikis/Contents/Resources/b25a226e-6c1e-4664-a114-7002b29d3fee

Error: Caught top-level exception: [PGCQueryError] Error executing query [INSERT INTO file_entity (entity_uid_fk, content_type, data_uid_fk) (SELECT entity_uid_fk, content_type, data_uid_fk FROM file_entity_scratch_20180328T141641)]: ERROR:  insert or update on table "file_entity" violates foreign key constraint "file_entity_data_uid_fk_fkey"
    DETAIL:  Key (data_uid_fk)=(c50dbd5c-e40a-46e9-9d41-3fe158b2f507) is not present in table "filedata_entity".
    , exiting
    Error: Exit with status: 27

I've tried changing the export options as well, using "-format legacy" which I think is the default anyway.

I'm at a loss as to what else I can do.

I tried just manually replacing /Library/Server/Wiki with the same folder from the old server and the new server did show the wiki but I'm afraid that's going to introduce other problems so I'd like to do this correctly.

Best Answer

Apple's solution was to connect the old server via 'target disk mode' to the new server and use Migration Assistant when initially setting up the new server, before creating any accounts, etc, to import all server data over.

Then when opening the latest Server app on the new server it'll successfully import in the wiki.

https://support.apple.com/en-us/HT207034