forked from simplcommerce/SimplCommerce
-
Notifications
You must be signed in to change notification settings - Fork 2
/
simpl-build.sh
22 lines (17 loc) · 1.09 KB
/
simpl-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
set -e
sed -i'' -e 's|<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />|<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" />|' src/SimplCommerce.WebHost/SimplCommerce.WebHost.csproj
sed -i'' -e 's/UseSqlServer/UseNpgsql/' src/SimplCommerce.WebHost/Startup.cs
sed -i'' -e 's/UseSqlServer/UseNpgsql/' src/SimplCommerce.WebHost/Extensions/ServiceCollectionExtensions.cs
rm -rf src/SimplCommerce.WebHost/Migrations/*
dotnet restore && dotnet build
cd src/SimplCommerce.WebHost \
&& npm install \
&& npm install --global gulp-cli \
&& gulp copy-modules \
&& dotnet ef migrations add initialSchema \
&& sed -i'' -e '/using SimplCommerce.Module.*.Models;/d' Migrations/SimplDbContextModelSnapshot.cs \
&& sed -i'' -e '/using SimplCommerce.Module.*.Models;/d' Migrations/*_initialSchema.Designer.cs \
&& dotnet ef database update
echo "The database schema has been created. Please execute the src/Database/StaticData_Postgres.sql to insert static data."
echo "Then type 'dotnet run' in src/SimplCommerce.WebHost to start the app."