Hi Vlad,
Gosh that's a lot of records!
Here a brief walkthrough of what I did:
- Exported the relevant tables from my clients' existing phpMyAdmin as .csv (tick 'Put columns names in the first row' - useful as a reference)
- Structure the columns in each .csv to be identical to the equivalent table in my SS database (even if some columns have no data)
- Save each .csv with a filename that matches the relevant table in my SS database (so I know which tables I'm importing into)
- Create backup of both the .csv files prior to mining, as well as the SS tables that will be imported into (just in case anything goes wrong!)
- Once completely happy with the columns in each .csv, I removed the column names (first row), as these were just for reference
- Before importing, make sure ID for each record in each .csv is unique, and that they are NOT already used by an existing record within the tables they'll be imported into (if starting a new project, it's probably best to do this before you start creating any other pages)
I structured the .csv files based on tables required for the blog add-on http://addons.silverstripe.org/add-ons/silverstripe/blog`, so the SS tables I needed a .csv for were (in this order):
- BlogPost_Tags.csv (prepped, imported and tested this first to familiarise myself with the process, and to check my approach worked!)
- SiteTree.csv
- SiteTree_live.csv (identical .csv to SiteTree)
- SiteTree_versions.csv
- BlogPost.csv
- BlogPost_live.csv (identical .csv to BlogPost)
- BlogPost_versions.csv
- (I didn't do BlogCategory as the existing articles only had tags, not categories associated with them)
A few additional notes to add:
- Excel kept mucking around with the date formatting for my `Created` and `LasteEdited` - I stopped it doing this by adding a space before the date in the .csv (once imported, phpMyAdmin ignores the space, and the date formats accordingly)
- Double check the date formats in your .csv before importing to ensure they match the format in the database
- I threw some of the date formats and other columns into Sublime Text to make batch formating changes more effectively, and then copied back into Excel
- Again, make sure you're not trying to import any pages/records which have an ID already used in the relevant SS table
- For BlogPost.csv, I had to set the `FeaturedImageID` for each record to 0, because in the database it's a required INT, so it couldn't be left empty
I hope the above helps! Obviously feel free to let me know you get on once you reach this point in your project, and happy to assist further. This is my very first SS project, so there might be a better way to the above, but this is just how I went about it; it wasn't much fun by any means, and took a good chunk of the morning up, but was far far better than having to manually re-create 280+ articles via the CMS itself.