Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

118 rindas
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. <!--#include file="Migration_07_Alter_Kit_Table_Labels_With_Set.asp"-->
  30. <%
  31. Sub HandleMigration
  32. putl "<b>Starting Version: " & Migrations.Version & "</b>"
  33. If Request.Form("mode") = "direct" then
  34. If Request.Form("direction") = "Up" then
  35. If Len(Request.Form("to")) > 0 then
  36. Migrations.MigrateUpTo(Request.Form("to"))
  37. Else
  38. Migrations.MigrateUp
  39. End If
  40. ElseIf Request.Form("direction") = "Down" then
  41. If Len(Request.Form("to")) > 0 then
  42. Migrations.MigrateDownTo(Request.Form("to"))
  43. Else
  44. Migrations.MigrateDown
  45. End If
  46. End If
  47. ElseIf Request.Form("mode") = "up_one" then
  48. Migrations.MigrateUpBy 1
  49. ElseIf Request.Form("mode") = "down_one" then
  50. Migrations.MigrateDownBy 1
  51. End If
  52. putl "<b style='color: darkgreen'>Final Version: " & Migrations.Version & "</b>"
  53. End Sub
  54. Sub ShowForm
  55. %>
  56. <form action="migrate.asp" method="POST">
  57. <input type="hidden" name="mode" value="direct">
  58. <p>
  59. <b>Direction: </b>
  60. <select name="direction">
  61. <option value="Up">Up</option>
  62. <option value="Down">Down</option>
  63. </select>
  64. &nbsp;&nbsp;
  65. <b>To: </b>
  66. <input type="text" size="5" name="to">
  67. &nbsp;&nbsp;
  68. <input type="Submit" value="Migrate!">
  69. </p>
  70. </form>
  71. <form action="migrate.asp" method="POST" style="display: inline">
  72. <input type="hidden" name="mode" value="up_one">
  73. <input type="Submit" value="Up 1">
  74. </form>
  75. <form action="migrate.asp" method="POST">
  76. <input type="hidden" name="mode" value="down_one">
  77. <input type="Submit" value="Down 1">
  78. </form>
  79. <hr>
  80. <%
  81. End Sub
  82. Sub Main
  83. ShowForm
  84. If Len(Request.Form("mode")) > 0 then
  85. HandleMigration
  86. Else
  87. putl "<b>Version: " & Migrations.Version & "</b>"
  88. End If
  89. End Sub
  90. %>
  91. <!doctype html>
  92. <html>
  93. <head>
  94. <style>
  95. body { font-family: calibri; }
  96. </style>
  97. </head>
  98. <body>
  99. <% Main %>
  100. </body>
  101. </html>

Powered by TurnKey Linux.