|
- <%
- ' Migration runner for AxonASP CLI (the WSH runMigrations.vbs cannot run on Linux/AxonASP).
- '
- ' docker exec -e SERVER_WEB_ROOT=/opt/axonasp/site -e MIGRATE=status axonasp ./axonasp-cli -r /opt/axonasp/site/scripts/migrate.asp
- ' MIGRATE = up (default) | down | status
- '
- Dim cmd : cmd = LCase(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%MIGRATE%"))
- If cmd = "%migrate%" Or cmd = "" Then cmd = "up"
- %>
- <!--#include file="../core/autoload_core.asp" -->
- <%
- Dim m : Set m = Migrator()
- m.MigrationsPath = Server.MapPath("/db/migrations") ' requires SERVER_WEB_ROOT=<framework folder>
- m.EnsureSchemaMigrationsTable
- Select Case cmd
- Case "up" : m.ApplyAllPending
- Case "down" : m.RollbackLast
- Case "status"
- Dim k
- Response.Write "Applied:" & vbCrLf
- For Each k In m.GetAppliedMigrations().Keys : Response.Write " " & k & vbCrLf : Next
- Response.Write "Pending:" & vbCrLf
- For Each k In m.GetPendingMigrations().Keys : Response.Write " " & k & vbCrLf : Next
- Case Else
- Response.Write "Unknown command: " & cmd & " (use up, down, status)" & vbCrLf
- End Select
- %>
|