source: PostgreSqlDotnetCore/Data/Migrations/20221229203724_Initial.cs

main
Last change on this file was 2aea0fd, checked in by ElenaMoskova <elena.moskova99@…>, 4 months ago

init commit Elena

  • Property mode set to 100644
File size: 10.6 KB
Line 
1using System;
2using Microsoft.EntityFrameworkCore.Migrations;
3using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
4
5#nullable disable
6
7namespace PostgreSqlDotnetCore.Migrations
8{
9 /// <inheritdoc />
10 public partial class Initial : Migration
11 {
12 /// <inheritdoc />
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 migrationBuilder.EnsureSchema(
16 name: "project");
17
18 migrationBuilder.CreateTable(
19 schema: "project",
20 name: "AspNetRoles",
21 columns: table => new
22 {
23 Id = table.Column<string>(type: "text", nullable: false),
24 Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
25 NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
26 ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
27 },
28 constraints: table =>
29 {
30 table.PrimaryKey("PK_AspNetRoles", x => x.Id);
31 });
32
33 migrationBuilder.CreateTable(
34 schema: "project",
35 name: "AspNetUsers",
36 columns: table => new
37 {
38 Id = table.Column<string>(type: "text", nullable: false),
39 UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
40 NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
41 Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
42 NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
43 EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
44 PasswordHash = table.Column<string>(type: "text", nullable: true),
45 SecurityStamp = table.Column<string>(type: "text", nullable: true),
46 ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
47 PhoneNumber = table.Column<string>(type: "text", nullable: true),
48 PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
49 TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
50 LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
51 LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
52 AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
53 },
54 constraints: table =>
55 {
56 table.PrimaryKey("PK_AspNetUsers", x => x.Id);
57 });
58
59 migrationBuilder.CreateTable(
60 schema: "project",
61 name: "AspNetRoleClaims",
62 columns: table => new
63 {
64 Id = table.Column<int>(type: "integer", nullable: false)
65 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
66 RoleId = table.Column<string>(type: "text", nullable: false),
67 ClaimType = table.Column<string>(type: "text", nullable: true),
68 ClaimValue = table.Column<string>(type: "text", nullable: true)
69 },
70 constraints: table =>
71 {
72 table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
73 table.ForeignKey(
74 name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
75 column: x => x.RoleId,
76 principalTable: "AspNetRoles",
77 principalColumn: "Id",
78 onDelete: ReferentialAction.Cascade);
79 });
80
81 migrationBuilder.CreateTable(
82 schema: "project",
83 name: "AspNetUserClaims",
84 columns: table => new
85 {
86 Id = table.Column<int>(type: "integer", nullable: false)
87 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
88 UserId = table.Column<string>(type: "text", nullable: false),
89 ClaimType = table.Column<string>(type: "text", nullable: true),
90 ClaimValue = table.Column<string>(type: "text", nullable: true)
91 },
92 constraints: table =>
93 {
94 table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
95 table.ForeignKey(
96 name: "FK_AspNetUserClaims_AspNetUsers_UserId",
97 column: x => x.UserId,
98 principalTable: "AspNetUsers",
99 principalColumn: "Id",
100 onDelete: ReferentialAction.Cascade);
101 });
102
103 migrationBuilder.CreateTable(
104 schema: "project",
105 name: "AspNetUserLogins",
106 columns: table => new
107 {
108 LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
109 ProviderKey = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
110 ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
111 UserId = table.Column<string>(type: "text", nullable: false)
112 },
113 constraints: table =>
114 {
115 table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
116 table.ForeignKey(
117 name: "FK_AspNetUserLogins_AspNetUsers_UserId",
118 column: x => x.UserId,
119 principalTable: "AspNetUsers",
120 principalColumn: "Id",
121 onDelete: ReferentialAction.Cascade);
122 });
123
124 migrationBuilder.CreateTable(
125 schema: "project",
126 name: "AspNetUserRoles",
127 columns: table => new
128 {
129 UserId = table.Column<string>(type: "text", nullable: false),
130 RoleId = table.Column<string>(type: "text", nullable: false)
131 },
132 constraints: table =>
133 {
134 table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
135 table.ForeignKey(
136 name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
137 column: x => x.RoleId,
138 principalTable: "AspNetRoles",
139 principalColumn: "Id",
140 onDelete: ReferentialAction.Cascade);
141 table.ForeignKey(
142 name: "FK_AspNetUserRoles_AspNetUsers_UserId",
143 column: x => x.UserId,
144 principalTable: "AspNetUsers",
145 principalColumn: "Id",
146 onDelete: ReferentialAction.Cascade);
147 });
148
149 migrationBuilder.CreateTable(
150 schema: "project",
151 name: "AspNetUserTokens",
152 columns: table => new
153 {
154 UserId = table.Column<string>(type: "text", nullable: false),
155 LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
156 Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
157 Value = table.Column<string>(type: "text", nullable: true)
158 },
159 constraints: table =>
160 {
161 table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
162 table.ForeignKey(
163 name: "FK_AspNetUserTokens_AspNetUsers_UserId",
164 column: x => x.UserId,
165 principalTable: "AspNetUsers",
166 principalColumn: "Id",
167 onDelete: ReferentialAction.Cascade);
168 });
169
170 migrationBuilder.CreateIndex(
171 name: "IX_AspNetRoleClaims_RoleId",
172 table: "AspNetRoleClaims",
173 column: "RoleId");
174
175 migrationBuilder.CreateIndex(
176 name: "RoleNameIndex",
177 table: "AspNetRoles",
178 column: "NormalizedName",
179 unique: true);
180
181 migrationBuilder.CreateIndex(
182 name: "IX_AspNetUserClaims_UserId",
183 table: "AspNetUserClaims",
184 column: "UserId");
185
186 migrationBuilder.CreateIndex(
187 name: "IX_AspNetUserLogins_UserId",
188 table: "AspNetUserLogins",
189 column: "UserId");
190
191 migrationBuilder.CreateIndex(
192 name: "IX_AspNetUserRoles_RoleId",
193 table: "AspNetUserRoles",
194 column: "RoleId");
195
196 migrationBuilder.CreateIndex(
197 name: "EmailIndex",
198 table: "AspNetUsers",
199 column: "NormalizedEmail");
200
201 migrationBuilder.CreateIndex(
202 name: "UserNameIndex",
203 table: "AspNetUsers",
204 column: "NormalizedUserName",
205 unique: true);
206 }
207
208 /// <inheritdoc />
209 protected override void Down(MigrationBuilder migrationBuilder)
210 {
211 migrationBuilder.DropTable(
212 name: "AspNetRoleClaims",
213 schema: "project");
214
215 migrationBuilder.DropTable(
216 name: "AspNetUserClaims",
217 schema: "project");
218
219 migrationBuilder.DropTable(
220 name: "AspNetUserLogins",
221 schema: "project");
222
223 migrationBuilder.DropTable(
224 name: "AspNetUserRoles",
225 schema: "project");
226
227 migrationBuilder.DropTable(
228 name: "AspNetUserTokens",
229 schema: "project");
230
231 migrationBuilder.DropTable(
232 name: "AspNetRoles",
233 schema: "project");
234
235 migrationBuilder.DropTable(
236 name: "AspNetUsers",
237 schema: "project");
238 }
239 }
240}
Note: See TracBrowser for help on using the repository browser.