Updated scripts and registered tasks.

reset_db.py now has the updated path.

Added reset database to tasks.

watch_all.py has improved output.
This commit is contained in:
Harrison Deng 2021-07-11 20:13:37 -05:00
parent 8b29c6f999
commit e953c52092
3 changed files with 12 additions and 3 deletions

View File

@ -45,6 +45,15 @@
"run"
],
"problemMatcher": ["$msCompile"]
},
{
"label": "reset database",
"command": "py",
"type": "process",
"args": [
"${workspaceFolder}/scripts/reset_db.py"
],
"problemMatcher": ["$msCompile"]
}
]
}

View File

@ -2,7 +2,7 @@ import os
import shutil
SERVER_DIR = "src/MultiShop/Server"
SERVER_DIR = "server"
DATA_DIR = "Data"
DB_MIGRATE_CMD = "dotnet ef migrations add InitialCreate -o {0}"
DB_UPDATE_CMD = "dotnet ef database update"

View File

@ -10,12 +10,12 @@ async def exec(cmd, path, silent=False):
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.chdir(os.pardir)
os.chdir(path)
print("Executing \"{0}\" in \"{1}\".".format(cmd, path))
proc = None
if (not silent):
print("Executing \"{0}\" in \"{1}\".".format(cmd, path))
proc = await asyncio.create_subprocess_shell(cmd)
else:
print("Executing in silent mode.")
print("Executing \"{0}\" in \"{1}\" silently.".format(cmd, path))
proc = await asyncio.create_subprocess_shell(cmd, stdout=devnull)
await proc.wait()