Your SlideShare is downloading. ×
0
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Database version control - pf congres version
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Database version control - pf congres version

1,513

Published on

Slides as used for my database version control talk at PF Congres. I removed the photo's because I wasn't exactly sure if the licenses the photo's were published under allowed me to redistribute them …

Slides as used for my database version control talk at PF Congres. I removed the photo's because I wasn't exactly sure if the licenses the photo's were published under allowed me to redistribute them in this slide show. I left the references to the original images in.

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,513
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide











































































  • Transcript

    1. Database Version Control Without Pain Harrie Verveer PFCongres - April 17th 2010
    2. Database Version Control What’s the problem? 2
    3. Here used to be an image of an airplane that I removed because of the license the image was published under http://www.sxc.hu/photo/754535
    4. Here used to be an image of an airplane that I removed because of the license the image was published under http://www.sxc.hu/photo/1207911
    5. http://en.wikipedia.org/wiki/File:STS120LaunchHiRes.jpg Here used to be an image of the space shuttle that I removed because of the license the image was published under
    6. http://www.sxc.hu/photo/1255121 Here used to be an image of a bike that I removed because of the license the image was published under
    7. Why Database Version Control 7
    8. Why Database Version Control Database Version Control is left behind 8
    9. Simple Patching Strategy The basic idea 9
    10. Simple patching strategy Patch files 10
    11. Simple patching strategy 11
    12. Simple patching strategy Mostly structural changes 12
    13. Simple patching strategy Chronological filenames 13
    14. Simple patching strategy Remember last executed patch 14
    15. Simple patching strategy Development Write code Write DB patches Apply patches to own DB Apply patches Commit Update 15
    16. Example patch file patch-001.sql 16
    17. Fixing patches patch-002.sql 17
    18. Fixing patches patch-002.sql 17
    19. Fixing patches patch-002.sql 17
    20. Fixing patches patch-003.sql 18
    21. Fixing patches patch-003.sql Never modify a patch file once it’s under version control 18
    22. Undo patch files patch-001.sql 19
    23. Undo patch files undo-001.sql 20
    24. Here used to be an image of a one-way sign that I removed because of the license the image was published under http://www.freefoto.com/preview/41-07-7
    25. Process Copy production to test environment Apply patches Run tests Backup live database Update production 22
    26. Bonus points Install.sql 23
    27. Bonus points Initial dummy content 24
    28. Here used to be an image of a guy in a rowing boat that I removed because of the license the image was published under http://www.sxc.hu/photo/643214
    29. Here used to be an image of a sunken boat that I removed because of the license the image was published under http://www.sxc.hu/photo/946855
    30. Automating the process Faster & Safer 27
    31. Typical patch script Run the patches 28
    32. Typical patch script Keep track of last executed patch 29
    33. Typical patch script 30
    34. Typical patch script 31
    35. Typical patch script 32
    36. Typical patch script update.sh 33
    37. Branches Merge problems 34
    38. Branches Trunk patch-001.sql patch-002.sql patch-003.sql 35
    39. Branches Trunk patch-001.sql patch-002.sql patch-003.sql Branch A create branch patch-004.sql patch-004.sql patch-005.sql patch-005.sql 36
    40. Branches Trunk patch-001.sql patch-002.sql patch-003.sql Branch A create branch patch-004.sql patch-004.sql patch-005.sql patch-005.sql Merge 37
    41. Branches Trunk patch-001.sql patch-002.sql patch-003.sql Branch A create branch patch-004.sql patch-006.sql patch-004.sql patch-005.sql patch-007.sql patch-005.sql Merge 37
    42. Branches Trunk patch-001.sql Branch A create branch patch-002.sql patch-002.sql patch-003.sql Branch B create branch patch-003.sql Merge patch-004.sql patch-004.sql patch-004.sql patch-005.sql patch-005.sql Merge patch-005.sql Merge Merge 38
    43. Separate sequence db/patches/trunk/ db/patches/branchA/ patch-001.sql patch-001.sql patch-002.sql patch-002.sql patch-003.sql 39
    44. Separate sequence db/patches/trunk/ db/patches/branchA/ patch-001.sql patch-001.sql patch-002.sql patch-002.sql patch-003.sql Trunk version 3 BranchA version 2 39
    45. Patchfile naming Filenames based on time 40
    46. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100323_0839.sql patch_20100327_1025.sql 41
    47. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100323_0839.sql patch_20100327_1025.sql Last executed: patch_20100327_1025 41
    48. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100322_2253.sql patch_20100323_0839.sql patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql Last executed: patch_20100327_1025 41
    49. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100322_2253.sql patch_20100323_0839.sql patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql Last executed: patch_20100327_1025 41
    50. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100322_2253.sql patch_20100323_0839.sql patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql patch_20100322_2158.sql patch_20100322_2253.sql Last executed: patch_20100323_0839.sql patch_20100327_1025 patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql 41
    51. Patch log At this point our patch number tracking doesn’t work anymore!!! patch_20100322_2158.sql patch_20100322_2253.sql patch_20100323_0839.sql patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql patch_20100322_2158.sql patch_20100322_2253.sql Last executed: patch_20100323_0839.sql patch_20100327_1025 patch_20100325_1528.sql patch_20100327_1025.sql patch_20100328_1230.sql 41
    52. Patch log 42
    53. Branches False sense of security 43
    54. Phing Avoiding the NIH syndrome 44
    55. http://phing.info/ 45
    56. Phing 46
    57. 47
    58. DB Deploy 48
    59. DB Deploy 49
    60. DB Deploy 49
    61. DB Deploy changelog table: 50
    62. DB Deploy changelog table: 50
    63. Akrabat DB Schema Manager Zend Framework specific solution 51
    64. Akrabat DB Schema Manager Zend Framework Proposed by Rob Allen in 2006 Recently implemented Might be in ZF in the near future http://github.com/akrabat/Akrabat 52
    65. Writing the patch scripts/migrations/001-CreateUserTable.php 53
    66. Writing the patch scripts/migrations/001-CreateUserTable.php 54
    67. Running the patch 55
    68. Running the patch 55
    69. Running the patch 56
    70. Running the patch 57
    71. Akrabat DB Schema Manager Easy to use if you know ZF PHP instead of SQL-only Easy to ‘undo’ patches Branch merging problem Run from your deploy script 58
    72. Multiple servers ssh harrie@webserver188 59
    73. http://www.capify.org/ 60
    74. Capistrano cd /dir/where/my/app/is svn update php updatedb.php 61
    75. Capistrano cd /dir/where/my/app/is svn update php updatedb.php 62
    76. Capistrano & the database 63
    77. Capistrano Automate deployment No coding needed Extending possible Useful tool for PHP developers Replace railsy voodoo with PHPish 1337ness 64
    78. Summary 65
    79. Summary Patchfiles • Automating • Branch merging Phing + DB Deploy http://phing.info http://dbdeploy.com Akrabat DB Schema Manager http://akrabat.com http://github.com/akrabat/Akrabat Capistrano http://capify.org 66
    80. Questions ? 67
    81. Contact me Harrie Verveer Software Engineer at Ibuildings E-mail: harrie@ibuildings.nl Skype: harrie-ibuildings Twitter: @harrieverveer http://joind.in/1499 68
    82. Dutch PHP Conference june 10 - 12 RAI Amsterdam http://phpconference.nl 69

    ×