You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.5KB

  1. <%
  2. Option Explicit
  3. Sub put(v)
  4. response.write v & "<br>"
  5. End Sub
  6. Sub put_
  7. put ""
  8. End Sub
  9. Sub put_error(s)
  10. put "<span style='color: red; font-weight: bold;'>" & s & "</span>"
  11. End Sub
  12. %>
  13. <!--#include file="../../MVC/lib.all.asp"-->
  14. <!--#include file="../../App/DAL/lib.DAL.asp"-->
  15. <!--#include file="lib.Migrations.asp"-->
  16. <%
  17. 'Have to initialize Migrations_Class before including any actual migrations, because they each automatically append themselves to the Migrations class for convenience.
  18. 'TODO: This can be refactored by not having the individual migration files auto-add themselves, but then this file must manually add each one using a slightly dIfferent
  19. ' naming convention, i.e. given include file 01_Create_Users.asp the command would be Migrations.Add "Migration_01_Create_Users" or such. At least this way is automated.
  20. Migrations.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"
  21. Migrations.Tracing = false
  22. %>
  23. <!--#include file="Migration_01_Create_Jurisdiction_Table.asp"-->
  24. <!--#include file="Migration_02_Create_Contact_Table.asp"-->
  25. <!--#include file="Migration_03_Create_Settings_Table.asp"-->
  26. <!--#include file="Migration_04_Create_Kit_Table.asp"-->
  27. <!--#include file="Migration_05_Create_Kit_Labels_Table.asp"-->
  28. <!--#include file="Migration_06_Alter_Kit_Tabl.asp"-->
  29. <%
  30. Sub HandleMigration
  31. putl "<b>Starting Version: " & Migrations.Version & "</b>"
  32. If Request.Form("mode") = "direct" then
  33. If Request.Form("direction") = "Up" then
  34. If Len(Request.Form("to")) > 0 then
  35. Migrations.MigrateUpTo(Request.Form("to"))
  36. Else
  37. Migrations.MigrateUp
  38. End If
  39. ElseIf Request.Form("direction") = "Down" then
  40. If Len(Request.Form("to")) > 0 then
  41. Migrations.MigrateDownTo(Request.Form("to"))
  42. Else
  43. Migrations.MigrateDown
  44. End If
  45. End If
  46. ElseIf Request.Form("mode") = "up_one" then
  47. Migrations.MigrateUpBy 1
  48. ElseIf Request.Form("mode") = "down_one" then
  49. Migrations.MigrateDownBy 1
  50. End If
  51. putl "<b style='color: darkgreen'>Final Version: " & Migrations.Version & "</b>"
  52. End Sub
  53. Sub ShowForm
  54. %>
  55. <form action="migrate.asp" method="POST">
  56. <input type="hidden" name="mode" value="direct">
  57. <p>
  58. <b>Direction: </b>
  59. <select name="direction">
  60. <option value="Up">Up</option>
  61. <option value="Down">Down</option>
  62. </select>
  63. &nbsp;&nbsp;
  64. <b>To: </b>
  65. <input type="text" size="5" name="to">
  66. &nbsp;&nbsp;
  67. <input type="Submit" value="Migrate!">
  68. </p>
  69. </form>
  70. <form action="migrate.asp" method="POST" style="display: inline">
  71. <input type="hidden" name="mode" value="up_one">
  72. <input type="Submit" value="Up 1">
  73. </form>
  74. <form action="migrate.asp" method="POST">
  75. <input type="hidden" name="mode" value="down_one">
  76. <input type="Submit" value="Down 1">
  77. </form>
  78. <hr>
  79. <%
  80. End Sub
  81. Sub Main
  82. ShowForm
  83. If Len(Request.Form("mode")) > 0 then
  84. HandleMigration
  85. Else
  86. putl "<b>Version: " & Migrations.Version & "</b>"
  87. End If
  88. End Sub
  89. %>
  90. <!doctype html>
  91. <html>
  92. <head>
  93. <style>
  94. body { font-family: calibri; }
  95. </style>
  96. </head>
  97. <body>
  98. <% Main %>
  99. </body>
  100. </html>

Powered by TurnKey Linux.