Updated lots of stuff, got multi scrape working, need to test not-nullable chapter novel ids with our current model, now supports sqlite and postgres concurrently (and easy add more), need to get it deployed/do auth
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-07-16 17:17:43 -04:00
parent eab3399268
commit d98324c11e
73 changed files with 1591 additions and 680 deletions

View File

@@ -0,0 +1,199 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DBConnection.Migrations.Sqlite
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Authors",
columns: table => new
{
Url = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModified = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Authors", x => x.Url);
});
migrationBuilder.CreateTable(
name: "Tags",
columns: table => new
{
TagValue = table.Column<string>(type: "TEXT", nullable: false),
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModified = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tags", x => x.TagValue);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Email = table.Column<string>(type: "TEXT", nullable: false),
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModified = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Novels",
columns: table => new
{
Url = table.Column<string>(type: "TEXT", nullable: false),
Guid = table.Column<Guid>(type: "TEXT", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: false),
AuthorUrl = table.Column<string>(type: "TEXT", nullable: true),
Status = table.Column<int>(type: "INTEGER", nullable: false),
LastUpdated = table.Column<DateTime>(type: "TEXT", nullable: false),
DatePosted = table.Column<DateTime>(type: "TEXT", nullable: false),
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModified = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Novels", x => x.Url);
table.ForeignKey(
name: "FK_Novels_Authors_AuthorUrl",
column: x => x.AuthorUrl,
principalTable: "Authors",
principalColumn: "Url");
});
migrationBuilder.CreateTable(
name: "Chapters",
columns: table => new
{
Url = table.Column<string>(type: "TEXT", nullable: false),
ChapterNumber = table.Column<int>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Content = table.Column<string>(type: "TEXT", nullable: true),
RawContent = table.Column<string>(type: "TEXT", nullable: true),
DatePosted = table.Column<DateTime>(type: "TEXT", nullable: true),
DateUpdated = table.Column<DateTime>(type: "TEXT", nullable: true),
LastContentFetch = table.Column<DateTime>(type: "TEXT", nullable: true),
NovelUrl = table.Column<string>(type: "TEXT", nullable: false),
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: false),
DateModified = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Chapters", x => x.Url);
table.ForeignKey(
name: "FK_Chapters_Novels_NovelUrl",
column: x => x.NovelUrl,
principalTable: "Novels",
principalColumn: "Url",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "NovelTag",
columns: table => new
{
NovelsUrl = table.Column<string>(type: "TEXT", nullable: false),
TagsTagValue = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NovelTag", x => new { x.NovelsUrl, x.TagsTagValue });
table.ForeignKey(
name: "FK_NovelTag_Novels_NovelsUrl",
column: x => x.NovelsUrl,
principalTable: "Novels",
principalColumn: "Url",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_NovelTag_Tags_TagsTagValue",
column: x => x.TagsTagValue,
principalTable: "Tags",
principalColumn: "TagValue",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserNovels",
columns: table => new
{
UserId = table.Column<int>(type: "INTEGER", nullable: false),
NovelUrl = table.Column<string>(type: "TEXT", nullable: false),
LastChapterRead = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserNovels", x => new { x.NovelUrl, x.UserId });
table.ForeignKey(
name: "FK_UserNovels_Novels_NovelUrl",
column: x => x.NovelUrl,
principalTable: "Novels",
principalColumn: "Url",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserNovels_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Chapters_NovelUrl",
table: "Chapters",
column: "NovelUrl");
migrationBuilder.CreateIndex(
name: "IX_Novels_AuthorUrl",
table: "Novels",
column: "AuthorUrl");
migrationBuilder.CreateIndex(
name: "IX_NovelTag_TagsTagValue",
table: "NovelTag",
column: "TagsTagValue");
migrationBuilder.CreateIndex(
name: "IX_UserNovels_UserId",
table: "UserNovels",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Chapters");
migrationBuilder.DropTable(
name: "NovelTag");
migrationBuilder.DropTable(
name: "UserNovels");
migrationBuilder.DropTable(
name: "Tags");
migrationBuilder.DropTable(
name: "Novels");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Authors");
}
}
}