We have a lot of sample data that is currently integrated into our CMS, so every new site starts with the same pages, text and images. This feels a bit messy to me, and I’m wondering if there’s a good way to segment the sample data from the rest of the app, and most importantly, a simple way to remove everything when it is time for the client to start entering their data.
I guess my ideal would be to have ‘packages’ of sample data that can be installed and removed via a single script. Are there any tools available to do anything like this?
You don’t really need to delete them, why not just have an if statement to show the tutorial if there is no user data to show on that page. If you used embedded video or image tutorials it would be easy to load in from a master site, making updates very easy.
I’ve been working with Rails a bit lately, and there is a file called seed.rb that clears out all tables and then loads them with the bare minimum data needed to start.
Applying the same concept to sample data, I think I will write a sample.php script that can be run to install a demo site, and then a seed.php file that can be run to reset the site to a barebones state, ready for the client’s data.
What do you mean? Rails provides a framework for you to plug in your own data? That script looks at your schema and generates random values within the allowable field tables? This is something you wrote or that comes with rails? I just like to keep it in a class, that way it can be ran not only “on demand” but also as a part of installers, etc…