|
| 1 | +/* |
| 2 | +* Use this file to load in some seed data. |
| 3 | +* |
| 4 | +* $ mysql -u root -p blog_demo < seed_data.sql |
| 5 | +* |
| 6 | +*/ |
| 7 | + |
| 8 | +/* Enable deletion of rows with foreign key constraints by disabled checks */ |
| 9 | + |
| 10 | +SET foreign_key_checks = 0; |
| 11 | + |
| 12 | + |
| 13 | +/* Delete all Tag records then re-load sample data */ |
| 14 | + |
| 15 | +TRUNCATE TABLE `tag`; |
| 16 | + |
| 17 | +INSERT INTO `tag` (id, `name`) VALUES |
| 18 | + (1, 'PHP'), |
| 19 | + (2, 'Quality Assurance'), |
| 20 | + (3, 'MySQL'), |
| 21 | + (4, 'php|tek'), |
| 22 | + (5, 'Arrays'), |
| 23 | + (6, 'PHPUnit'), |
| 24 | + (7, 'Refactoring'), |
| 25 | + (8, 'Tools'), |
| 26 | + (9, 'Build Process'), |
| 27 | + (10, 'Deployment'), |
| 28 | + (11, 'Integration'), |
| 29 | + (12, 'dpc12'), |
| 30 | + (13, 'PHPDocumentor'), |
| 31 | + (14, 'Security'), |
| 32 | + (15, 'Design Patterns'), |
| 33 | + (16, 'phpnw11'), |
| 34 | + (17, 'dpc11'), |
| 35 | + (18, 'Webservices'), |
| 36 | + (19, 'Optimisation') |
| 37 | + ; |
| 38 | + |
| 39 | + |
| 40 | +/* Delete all author records then re-load sample data */ |
| 41 | + |
| 42 | +TRUNCATE TABLE `author`; |
| 43 | + |
| 44 | +INSERT INTO `author` (`id`, `name`, username ) VALUES |
| 45 | + (1, 'Joe Blogs','blowFish'), |
| 46 | + (2, 'Ann Other','blog_queen'), |
| 47 | + (3, 'John Smith','smithie'), |
| 48 | + (4, 'Howard Jones','solo') |
| 49 | + ; |
| 50 | + |
| 51 | + |
| 52 | +/* Delete all Category records then re-load sample data */ |
| 53 | + |
| 54 | +TRUNCATE TABLE `category`; |
| 55 | + |
| 56 | +INSERT INTO `category` (`id`, `parent_id`, `name`) VALUES |
| 57 | + (8, NULL, 'PHP'), |
| 58 | + (9, 8, 'Quality Assurance'), |
| 59 | + (10, NULL, 'Databases'), |
| 60 | + (11, 10, 'MySQL'), |
| 61 | + (12, 9, 'Test Driven Development'), |
| 62 | + (13, 8, 'Object Orientation'), |
| 63 | + (14, 13, 'Design Patterns'), |
| 64 | + (15, 10, 'CouchDB'), |
| 65 | + (16, 8, 'Frameworks'), |
| 66 | + (17, 16, 'Zend Framework'), |
| 67 | + (18, 16, 'Symfony'), |
| 68 | + (19, 16, 'Symfony2'), |
| 69 | + (20, 8, 'Webservices') |
| 70 | + ; |
| 71 | + |
| 72 | +/* Delete all post records then re-load sample data */ |
| 73 | + |
| 74 | +TRUNCATE TABLE `post`; |
| 75 | + |
| 76 | +INSERT INTO `post` (author_id, `slug`, title, `content`, published, created, updated) VALUES |
| 77 | + (1, |
| 78 | + 'mysql-queries-the-right-way', |
| 79 | + 'MySQL queries - the right way', |
| 80 | + 'Sweet jelly beans bonbon jelly beans dragée. Lollipop I love marshmallow chocolate faworki gingerbread jelly-o icing faworki. Lollipop jelly beans chupa chups fruitcake. Apple pie cheesecake tart. Gummi bears sugar plum soufflé chupa chups. Tiramisu brownie macaroon I love soufflé carrot cake chocolate bar. I love chocolate I love lollipop. Pastry tootsie roll cupcake lollipop dragée marzipan. Tootsie roll liquorice macaroon lollipop gingerbread jelly beans. Soufflé applicake tiramisu sweet roll liquorice lemon drops toffee macaroon. Ice cream oat cake ice cream oat cake. Muffin cookie tiramisu cheesecake danish gingerbread biscuit. I love marshmallow candy sugar plum fruitcake gingerbread chocolate oat cake. Chocolate bar I love tart liquorice halvah pastry wypas I love macaroon. Dragée sweet lemon drops jelly beans wypas cake. Tiramisu danish jelly-o cheesecake topping pie candy. Cotton candy soufflé powder chocolate I love tart brownie. Chocolate bar cake pastry I love chocolate cake topping marshmallow. Croissant jelly beans topping dragée dessert marshmallow gummies biscuit I love. I love icing I love jelly donut topping fruitcake gingerbread topping. Gingerbread dragée bear claw I love bear claw cookie pie brownie I love. Tart dessert bonbon faworki sesame snaps. Bonbon cupcake cookie. Fruitcake toffee I love I love bonbon biscuit jujubes candy canes I love. Halvah cotton candy sugar plum bear claw sesame snaps jujubes carrot cake soufflé muffin. Sugar plum oat cake I love cupcake.', |
| 81 | + '08-05-2011 17:54:02', |
| 82 | + '08-04-2011 23:04:52', |
| 83 | + '00-00-0000 00:00:00') |
| 84 | + ; |
| 85 | + |
| 86 | + |
| 87 | +/* Delete all post_category records then re-load sample data */ |
| 88 | + |
| 89 | +TRUNCATE TABLE `post_category`; |
| 90 | + |
| 91 | +INSERT INTO post_category (post_id, category_id) VALUES |
| 92 | + (1, 11) |
| 93 | + ; |
| 94 | + |
| 95 | +/* Delete all post_tag records then re-load sample data */ |
| 96 | + |
| 97 | +TRUNCATE TABLE `post_tag`; |
| 98 | + |
| 99 | +INSERT INTO post_tag (post_id, tag_id) VALUES |
| 100 | + (1, 3), |
| 101 | + (1, 19) |
| 102 | + ; |
| 103 | + |
| 104 | + |
| 105 | +/* Reenable foreign key constrain checks in MySQL */ |
| 106 | + |
| 107 | +SET foreign_key_checks = 1; |
0 commit comments