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.0KB

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

Powered by TurnKey Linux.