aboutsummaryrefslogtreecommitdiff
path: root/Timeline
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-20 17:52:30 +0800
committer杨宇千 <crupest@outlook.com>2019-07-20 17:52:30 +0800
commita97a7c58c6d7b998432cbe3b09cedee463c46653 (patch)
treebe100242d13e0745f01a77b59cacca1025814f84 /Timeline
parentf0a317cc511a4a7b04a701c32881d1e3331f3711 (diff)
downloadtimeline-a97a7c58c6d7b998432cbe3b09cedee463c46653.tar.gz
timeline-a97a7c58c6d7b998432cbe3b09cedee463c46653.tar.bz2
timeline-a97a7c58c6d7b998432cbe3b09cedee463c46653.zip
Add version column in user database.
Diffstat (limited to 'Timeline')
-rw-r--r--Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs49
-rw-r--r--Timeline/Migrations/20190719115321_Add-User-Version.cs23
-rw-r--r--Timeline/Migrations/DatabaseContextModelSnapshot.cs5
-rw-r--r--Timeline/Models/DatabaseContext.cs3
-rw-r--r--Timeline/Services/JwtService.cs1
5 files changed, 79 insertions, 2 deletions
diff --git a/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs b/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs
new file mode 100644
index 00000000..42eeeb40
--- /dev/null
+++ b/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs
@@ -0,0 +1,49 @@
+// <auto-generated />
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Timeline.Models;
+
+namespace Timeline.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20190719115321_Add-User-Version")]
+ partial class AddUserVersion
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Timeline.Models.User", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("id");
+
+ b.Property<string>("EncryptedPassword")
+ .IsRequired()
+ .HasColumnName("password");
+
+ b.Property<string>("Name")
+ .IsRequired()
+ .HasColumnName("name");
+
+ b.Property<string>("RoleString")
+ .IsRequired()
+ .HasColumnName("roles");
+
+ b.Property<long>("Version")
+ .HasColumnName("version");
+
+ b.HasKey("Id");
+
+ b.ToTable("user");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Timeline/Migrations/20190719115321_Add-User-Version.cs b/Timeline/Migrations/20190719115321_Add-User-Version.cs
new file mode 100644
index 00000000..715af909
--- /dev/null
+++ b/Timeline/Migrations/20190719115321_Add-User-Version.cs
@@ -0,0 +1,23 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Timeline.Migrations
+{
+ public partial class AddUserVersion : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<long>(
+ name: "version",
+ table: "user",
+ nullable: false,
+ defaultValue: 0L);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "version",
+ table: "user");
+ }
+ }
+}
diff --git a/Timeline/Migrations/DatabaseContextModelSnapshot.cs b/Timeline/Migrations/DatabaseContextModelSnapshot.cs
index a833d2dc..7d244969 100644
--- a/Timeline/Migrations/DatabaseContextModelSnapshot.cs
+++ b/Timeline/Migrations/DatabaseContextModelSnapshot.cs
@@ -13,7 +13,7 @@ namespace Timeline.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
+ .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Timeline.Models.User", b =>
@@ -34,6 +34,9 @@ namespace Timeline.Migrations
.IsRequired()
.HasColumnName("roles");
+ b.Property<long>("Version")
+ .HasColumnName("version");
+
b.HasKey("Id");
b.ToTable("user");
diff --git a/Timeline/Models/DatabaseContext.cs b/Timeline/Models/DatabaseContext.cs
index 1e89ea82..87c0fd17 100644
--- a/Timeline/Models/DatabaseContext.cs
+++ b/Timeline/Models/DatabaseContext.cs
@@ -18,6 +18,9 @@ namespace Timeline.Models
[Column("roles"), Required]
public string RoleString { get; set; }
+
+ [Column("version"), Required]
+ public long Version { get; set; }
}
public class DatabaseContext : DbContext
diff --git a/Timeline/Services/JwtService.cs b/Timeline/Services/JwtService.cs
index f5df59a5..2139ba56 100644
--- a/Timeline/Services/JwtService.cs
+++ b/Timeline/Services/JwtService.cs
@@ -7,7 +7,6 @@ using System.Linq;
using System.Security.Claims;
using System.Text;
using Timeline.Configs;
-using Timeline.Entities;
namespace Timeline.Services
{