in dotnet/space-translate/SpaceTranslate/Migrations/20220316152050_Initial.cs [10:66]
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Organizations",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
ServerUrl = table.Column<string>(type: "TEXT", nullable: false),
ClientId = table.Column<string>(type: "TEXT", nullable: false),
ClientSecret = table.Column<string>(type: "TEXT", nullable: false),
UserId = table.Column<string>(type: "TEXT", nullable: false),
SigningKey = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Organizations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
OrganizationId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<string>(type: "TEXT", nullable: false),
Scope = table.Column<string>(type: "TEXT", maxLength: 2147483647, nullable: true),
RefreshToken = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
table.ForeignKey(
name: "FK_Users_Organizations_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organizations",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_ClientId",
table: "Organizations",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ServerUrl",
table: "Organizations",
column: "ServerUrl");
migrationBuilder.CreateIndex(
name: "IX_Users_OrganizationId",
table: "Users",
column: "OrganizationId");
}