1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Timeline.Migrations
{
public partial class AddUserTokenTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user_token",
columns: table => new
{
id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
user_id = table.Column<long>(type: "INTEGER", nullable: false),
token = table.Column<string>(type: "TEXT", nullable: false),
expire_at = table.Column<DateTime>(type: "TEXT", nullable: true),
create_at = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_user_token", x => x.id);
table.ForeignKey(
name: "FK_user_token_users_user_id",
column: x => x.user_id,
principalTable: "users",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_user_token_token",
table: "user_token",
column: "token",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_user_token_user_id",
table: "user_token",
column: "user_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "user_token");
}
}
}
|