Skip to content

Commit ee4b779

Browse files
committed
Use a cross-platform friendly create migration script
1 parent 081c425 commit ee4b779

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

api/Migrations/DefaultDbContextModelSnapshot.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,26 @@ protected override void BuildModel(ModelBuilder modelBuilder)
9191

9292
modelBuilder.Entity("aspnetCoreReactTemplate.Models.Contact", b =>
9393
{
94-
b.Property<int>("id")
94+
b.Property<int>("Id")
9595
.ValueGeneratedOnAdd()
9696
.HasColumnName("id");
9797

98-
b.Property<string>("email")
98+
b.Property<string>("Email")
9999
.HasColumnName("email")
100100
.HasMaxLength(30);
101101

102-
b.Property<string>("firstName")
102+
b.Property<string>("FirstName")
103103
.IsRequired()
104104
.HasColumnName("first_name");
105105

106-
b.Property<string>("lastName")
106+
b.Property<string>("LastName")
107107
.IsRequired()
108108
.HasColumnName("last_name");
109109

110-
b.Property<string>("phone")
110+
b.Property<string>("Phone")
111111
.HasColumnName("phone");
112112

113-
b.HasKey("id")
113+
b.HasKey("Id")
114114
.HasName("pk_contacts");
115115

116116
b.ToTable("contacts");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"pretest:client": "./node_modules/typescript/bin/tsc -p ./client-react.test/",
1111
"test:client": "mocha --require ignore-styles --recursive client-react.test/build/client-react.test",
1212
"test": "npm run test:api && npm run test:client",
13-
"migrate": "cd ./api/ && dotnet ef migrations add $(date +%s) && dotnet ef database update",
13+
"migrate": "cd ./api/ && node ../scripts/create-migration.js && dotnet ef database update",
1414
"prestart": "docker-compose up -d",
1515
"start": "cd ./api && cross-env NODE_PATH=../node_modules/ ASPNETCORE_ENVIRONMENT=Development dotnet watch run",
1616
"start:release": "npm run prerelease && cd ./api/bin/Release/netcoreapp1.0/publish/ && dotnet api.dll",

scripts/create-migration.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const timestamp = Math.floor(new Date().getTime()/1000).toString();
2+
const execSync = require("child_process").execSync;
3+
execSync(`dotnet ef migrations add ${timestamp}`);

0 commit comments

Comments
 (0)