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.

migrate.asp 4.1KB

11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.Initialize "Provider=SQLOLEDB;Server=danielsubuntu,15789;Database=tracking;UID=sa;PWD=SunBrightShine!;"
  22. Migrations.Tracing = false
  23. %>
  24. <!--#include file="Migration_01_Create_Jurisdiction_Table.asp"-->
  25. <!--#include file="Migration_02_Create_Contact_Table.asp"-->
  26. <!--#include file="Migration_03_Create_Settings_Table.asp"-->
  27. <!--#include file="Migration_04_Create_Kit_Table.asp"-->
  28. <!--#include file="Migration_05_Create_Kit_Labels_Table.asp"-->
  29. <!--#include file="Migration_06_Alter_Kit_Tabl.asp"-->
  30. <!--#include file="Migration_07_Alter_Kit_Table_Labels_With_Set.asp"-->
  31. <!--#include file="Migration_08_Alter_Kit_Table_With_InkjetJob.asp"-->
  32. <!--#include file="Migration_09_Create_InkJetRecords_Table.asp"-->
  33. <!--#include file="Migration_10_Alter_Tables_For_Relations.asp"-->
  34. <!--#include file="Migration_11_Alter_Tables_For_Relations_FK.asp"-->
  35. <!--#include file="Migration_12_Alter_Kit_Table_With_Type.asp"-->
  36. <!--#include file="Migration_13_Alter_Kit_Table_With_File_Cass.asp"-->
  37. <!--#include file="Migration_14_Alter_Kit_Table_With_STIDS.asp"-->
  38. <%
  39. Sub HandleMigration
  40. putl "<b>Starting Version: " & Migrations.Version & "</b>"
  41. If Request.Form("mode") = "direct" then
  42. If Request.Form("direction") = "Up" then
  43. If Len(Request.Form("to")) > 0 then
  44. Migrations.MigrateUpTo(Request.Form("to"))
  45. Else
  46. Migrations.MigrateUp
  47. End If
  48. ElseIf Request.Form("direction") = "Down" then
  49. If Len(Request.Form("to")) > 0 then
  50. Migrations.MigrateDownTo(Request.Form("to"))
  51. Else
  52. Migrations.MigrateDown
  53. End If
  54. End If
  55. ElseIf Request.Form("mode") = "up_one" then
  56. Migrations.MigrateUpBy 1
  57. ElseIf Request.Form("mode") = "down_one" then
  58. Migrations.MigrateDownBy 1
  59. End If
  60. putl "<b style='color: darkgreen'>Final Version: " & Migrations.Version & "</b>"
  61. End Sub
  62. Sub ShowForm
  63. %>
  64. <form action="migrate.asp" method="POST">
  65. <input type="hidden" name="mode" value="direct">
  66. <p>
  67. <b>Direction: </b>
  68. <select name="direction">
  69. <option value="Up">Up</option>
  70. <option value="Down">Down</option>
  71. </select>
  72. &nbsp;&nbsp;
  73. <b>To: </b>
  74. <input type="text" size="5" name="to">
  75. &nbsp;&nbsp;
  76. <input type="Submit" value="Migrate!">
  77. </p>
  78. </form>
  79. <form action="migrate.asp" method="POST" style="display: inline">
  80. <input type="hidden" name="mode" value="up_one">
  81. <input type="Submit" value="Up 1">
  82. </form>
  83. <form action="migrate.asp" method="POST">
  84. <input type="hidden" name="mode" value="down_one">
  85. <input type="Submit" value="Down 1">
  86. </form>
  87. <hr>
  88. <%
  89. End Sub
  90. Sub Main
  91. ShowForm
  92. If Len(Request.Form("mode")) > 0 then
  93. HandleMigration
  94. Else
  95. putl "<b>Version: " & Migrations.Version & "</b>"
  96. End If
  97. End Sub
  98. %>
  99. <!doctype html>
  100. <html>
  101. <head>
  102. <style>
  103. body { font-family: calibri; }
  104. </style>
  105. </head>
  106. <body>
  107. <% Main %>
  108. </body>
  109. </html>

Powered by TurnKey Linux.