Revert "chore: format via csharpier"

This reverts commit 7a2eb699f4.
This commit is contained in:
2026-01-09 15:24:19 -05:00
parent 7a2eb699f4
commit 6bea6c49be
35 changed files with 464 additions and 784 deletions
@@ -14,8 +14,7 @@ namespace SharpbinV3.Server.Migrations
name: "Users",
columns: table => new
{
UID = table
.Column<int>(type: "INTEGER", nullable: false)
UID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UUID = table.Column<Guid>(type: "TEXT", nullable: false),
Username = table.Column<string>(type: "TEXT", nullable: false),
@@ -24,20 +23,18 @@ namespace SharpbinV3.Server.Migrations
DisplayName = table.Column<string>(type: "TEXT", nullable: true),
LastLogin = table.Column<long>(type: "INTEGER", nullable: true),
Roles = table.Column<string>(type: "TEXT", nullable: false),
Visiblity = table.Column<int>(type: "INTEGER", nullable: false),
Visiblity = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.UID);
}
);
});
migrationBuilder.CreateTable(
name: "Pastes",
columns: table => new
{
PID = table
.Column<int>(type: "INTEGER", nullable: false)
PID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UUID = table.Column<string>(type: "TEXT", nullable: false),
ID = table.Column<string>(type: "TEXT", nullable: true),
@@ -51,7 +48,7 @@ namespace SharpbinV3.Server.Migrations
Views = table.Column<int>(type: "INTEGER", nullable: false),
Syntax = table.Column<string>(type: "TEXT", nullable: true),
Visiblity = table.Column<int>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<long>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
@@ -60,10 +57,8 @@ namespace SharpbinV3.Server.Migrations
name: "FK_Pastes_Users_UserUID",
column: x => x.UserUID,
principalTable: "Users",
principalColumn: "UID"
);
}
);
principalColumn: "UID");
});
migrationBuilder.CreateTable(
name: "RefreshTokens",
@@ -75,7 +70,7 @@ namespace SharpbinV3.Server.Migrations
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<long>(type: "INTEGER", nullable: false),
Used = table.Column<bool>(type: "INTEGER", nullable: false),
UserUID = table.Column<int>(type: "INTEGER", nullable: true),
UserUID = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
@@ -84,87 +79,81 @@ namespace SharpbinV3.Server.Migrations
name: "FK_RefreshTokens_Users_UserUID",
column: x => x.UserUID,
principalTable: "Users",
principalColumn: "UID"
);
}
);
principalColumn: "UID");
});
migrationBuilder.CreateIndex(
name: "IX_Pastes_AuthorUUID",
table: "Pastes",
column: "AuthorUUID"
);
column: "AuthorUUID");
migrationBuilder.CreateIndex(
name: "IX_Pastes_ExpiresAt",
table: "Pastes",
column: "ExpiresAt"
);
column: "ExpiresAt");
migrationBuilder.CreateIndex(
name: "IX_Pastes_ID",
table: "Pastes",
column: "ID",
unique: true
);
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Pastes_PID",
table: "Pastes",
column: "PID",
unique: true
);
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Pastes_UserUID",
table: "Pastes",
column: "UserUID"
);
column: "UserUID");
migrationBuilder.CreateIndex(
name: "IX_Pastes_UUID",
table: "Pastes",
column: "UUID",
unique: true
);
unique: true);
migrationBuilder.CreateIndex(name: "IX_Pastes_Views", table: "Pastes", column: "Views");
migrationBuilder.CreateIndex(
name: "IX_Pastes_Views",
table: "Pastes",
column: "Views");
migrationBuilder.CreateIndex(
name: "IX_Pastes_Visiblity",
table: "Pastes",
column: "Visiblity"
);
column: "Visiblity");
migrationBuilder.CreateIndex(
name: "IX_RefreshTokens_UserUID",
table: "RefreshTokens",
column: "UserUID"
);
column: "UserUID");
migrationBuilder.CreateIndex(
name: "IX_Users_UID",
table: "Users",
column: "UID",
unique: true
);
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Users_UUID",
table: "Users",
column: "UUID",
unique: true
);
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "Pastes");
migrationBuilder.DropTable(
name: "Pastes");
migrationBuilder.DropTable(name: "RefreshTokens");
migrationBuilder.DropTable(
name: "RefreshTokens");
migrationBuilder.DropTable(name: "Users");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -10,39 +10,42 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "FilePath", table: "Pastes");
migrationBuilder.DropColumn(
name: "FilePath",
table: "Pastes");
migrationBuilder.AddColumn<byte[]>(
name: "Data",
table: "Pastes",
type: "BLOB",
nullable: false,
defaultValue: new byte[0]
);
defaultValue: new byte[0]);
migrationBuilder.AddColumn<bool>(
name: "IsCompressed",
table: "Pastes",
type: "INTEGER",
nullable: false,
defaultValue: false
);
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "Data", table: "Pastes");
migrationBuilder.DropColumn(
name: "Data",
table: "Pastes");
migrationBuilder.DropColumn(name: "IsCompressed", table: "Pastes");
migrationBuilder.DropColumn(
name: "IsCompressed",
table: "Pastes");
migrationBuilder.AddColumn<string>(
name: "FilePath",
table: "Pastes",
type: "TEXT",
nullable: false,
defaultValue: ""
);
defaultValue: "");
}
}
}
@@ -10,13 +10,19 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(name: "Data", table: "Pastes", newName: "Content");
migrationBuilder.RenameColumn(
name: "Data",
table: "Pastes",
newName: "Content");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(name: "Content", table: "Pastes", newName: "Data");
migrationBuilder.RenameColumn(
name: "Content",
table: "Pastes",
newName: "Data");
}
}
}
@@ -13,14 +13,12 @@ namespace SharpbinV3.Server.Migrations
migrationBuilder.RenameColumn(
name: "Visiblity",
table: "Pastes",
newName: "Visibility"
);
newName: "Visibility");
migrationBuilder.RenameIndex(
name: "IX_Pastes_Visiblity",
table: "Pastes",
newName: "IX_Pastes_Visibility"
);
newName: "IX_Pastes_Visibility");
}
/// <inheritdoc />
@@ -29,14 +27,12 @@ namespace SharpbinV3.Server.Migrations
migrationBuilder.RenameColumn(
name: "Visibility",
table: "Pastes",
newName: "Visiblity"
);
newName: "Visiblity");
migrationBuilder.RenameIndex(
name: "IX_Pastes_Visibility",
table: "Pastes",
newName: "IX_Pastes_Visiblity"
);
newName: "IX_Pastes_Visiblity");
}
}
}
@@ -10,22 +10,29 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_Users_UID", table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_UID",
table: "Users");
migrationBuilder.RenameColumn(name: "Visiblity", table: "Users", newName: "Visibility");
migrationBuilder.RenameColumn(
name: "Visiblity",
table: "Users",
newName: "Visibility");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(name: "Visibility", table: "Users", newName: "Visiblity");
migrationBuilder.RenameColumn(
name: "Visibility",
table: "Users",
newName: "Visiblity");
migrationBuilder.CreateIndex(
name: "IX_Users_UID",
table: "Users",
column: "UID",
unique: true
);
unique: true);
}
}
}
@@ -8,9 +8,15 @@ namespace SharpbinV3.Server.Migrations
public partial class LongFileSizes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) { }
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) { }
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
@@ -10,35 +10,47 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_Pastes_Users_UserUID", table: "Pastes");
migrationBuilder.DropForeignKey(
name: "FK_Pastes_Users_UserUID",
table: "Pastes");
migrationBuilder.DropForeignKey(
name: "FK_RefreshTokens_Users_UserUID",
table: "RefreshTokens"
);
table: "RefreshTokens");
migrationBuilder.DropPrimaryKey(name: "PK_Users", table: "Users");
migrationBuilder.DropPrimaryKey(
name: "PK_Users",
table: "Users");
migrationBuilder.DropIndex(name: "IX_RefreshTokens_UserUID", table: "RefreshTokens");
migrationBuilder.DropIndex(
name: "IX_RefreshTokens_UserUID",
table: "RefreshTokens");
migrationBuilder.DropIndex(name: "IX_Pastes_UserUID", table: "Pastes");
migrationBuilder.DropIndex(
name: "IX_Pastes_UserUID",
table: "Pastes");
migrationBuilder.DropColumn(name: "UserUID", table: "RefreshTokens");
migrationBuilder.DropColumn(
name: "UserUID",
table: "RefreshTokens");
migrationBuilder.DropColumn(name: "UserUID", table: "Pastes");
migrationBuilder.DropColumn(
name: "UserUID",
table: "Pastes");
migrationBuilder
.AlterColumn<int>(
name: "UID",
table: "Users",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER"
)
migrationBuilder.AlterColumn<int>(
name: "UID",
table: "Users",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.OldAnnotation("Sqlite:Autoincrement", true);
migrationBuilder.AddPrimaryKey(name: "PK_Users", table: "Users", column: "UUID");
migrationBuilder.AddPrimaryKey(
name: "PK_Users",
table: "Users",
column: "UUID");
migrationBuilder.AddForeignKey(
name: "FK_Pastes_Users_AuthorUUID",
@@ -46,8 +58,7 @@ namespace SharpbinV3.Server.Migrations
column: "AuthorUUID",
principalTable: "Users",
principalColumn: "UUID",
onDelete: ReferentialAction.Cascade
);
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RefreshTokens_Users_UserUUID",
@@ -55,76 +66,73 @@ namespace SharpbinV3.Server.Migrations
column: "UserUUID",
principalTable: "Users",
principalColumn: "UUID",
onDelete: ReferentialAction.Cascade
);
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_Pastes_Users_AuthorUUID", table: "Pastes");
migrationBuilder.DropForeignKey(
name: "FK_Pastes_Users_AuthorUUID",
table: "Pastes");
migrationBuilder.DropForeignKey(
name: "FK_RefreshTokens_Users_UserUUID",
table: "RefreshTokens"
);
table: "RefreshTokens");
migrationBuilder.DropPrimaryKey(name: "PK_Users", table: "Users");
migrationBuilder.DropPrimaryKey(
name: "PK_Users",
table: "Users");
migrationBuilder
.AlterColumn<int>(
name: "UID",
table: "Users",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER"
)
migrationBuilder.AlterColumn<int>(
name: "UID",
table: "Users",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.Annotation("Sqlite:Autoincrement", true);
migrationBuilder.AddColumn<int>(
name: "UserUID",
table: "RefreshTokens",
type: "INTEGER",
nullable: true
);
nullable: true);
migrationBuilder.AddColumn<int>(
name: "UserUID",
table: "Pastes",
type: "INTEGER",
nullable: true
);
nullable: true);
migrationBuilder.AddPrimaryKey(name: "PK_Users", table: "Users", column: "UID");
migrationBuilder.AddPrimaryKey(
name: "PK_Users",
table: "Users",
column: "UID");
migrationBuilder.CreateIndex(
name: "IX_RefreshTokens_UserUID",
table: "RefreshTokens",
column: "UserUID"
);
column: "UserUID");
migrationBuilder.CreateIndex(
name: "IX_Pastes_UserUID",
table: "Pastes",
column: "UserUID"
);
column: "UserUID");
migrationBuilder.AddForeignKey(
name: "FK_Pastes_Users_UserUID",
table: "Pastes",
column: "UserUID",
principalTable: "Users",
principalColumn: "UID"
);
principalColumn: "UID");
migrationBuilder.AddForeignKey(
name: "FK_RefreshTokens_Users_UserUID",
table: "RefreshTokens",
column: "UserUID",
principalTable: "Users",
principalColumn: "UID"
);
principalColumn: "UID");
}
}
}
@@ -10,30 +10,25 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
"""
CREATE TRIGGER Users_UID_AutoIncrement
AFTER INSERT ON Users
BEGIN
UPDATE Users
SET UID = (
SELECT IFNULL(MAX(UID), 0) + 1 FROM Users
)
WHERE rowid = NEW.rowid AND NEW.UID IS NULL;
END;
""",
suppressTransaction: true
);
}
migrationBuilder.Sql("""
CREATE TRIGGER Users_UID_AutoIncrement
AFTER INSERT ON Users
BEGIN
UPDATE Users
SET UID = (
SELECT IFNULL(MAX(UID), 0) + 1 FROM Users
)
WHERE rowid = NEW.rowid AND NEW.UID IS NULL;
END;
""", suppressTransaction: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
"""
DROP TRIGGER IF EXISTS Users_UID_AutoIncrement;
"""
);
migrationBuilder.Sql("""
DROP TRIGGER IF EXISTS Users_UID_AutoIncrement;
""");
}
}
}
@@ -14,14 +14,15 @@ namespace SharpbinV3.Server.Migrations
name: "IX_Users_UID",
table: "Users",
column: "UID",
unique: true
);
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_Users_UID", table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_UID",
table: "Users");
}
}
}
@@ -10,7 +10,9 @@ namespace SharpbinV3.Server.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_Users_UID", table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_UID",
table: "Users");
migrationBuilder.AlterColumn<int>(
name: "UID",
@@ -18,16 +20,20 @@ namespace SharpbinV3.Server.Migrations
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER"
);
oldType: "INTEGER");
migrationBuilder.CreateIndex(name: "IX_Users_UID", table: "Users", column: "UID");
migrationBuilder.CreateIndex(
name: "IX_Users_UID",
table: "Users",
column: "UID");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(name: "IX_Users_UID", table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_UID",
table: "Users");
migrationBuilder.AlterColumn<int>(
name: "UID",
@@ -37,15 +43,13 @@ namespace SharpbinV3.Server.Migrations
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true
);
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_Users_UID",
table: "Users",
column: "UID",
unique: true
);
unique: true);
}
}
}
@@ -16,8 +16,7 @@ namespace SharpbinV3.Server.Migrations
type: "TEXT",
nullable: true,
oldClrType: typeof(Guid),
oldType: "TEXT"
);
oldType: "TEXT");
}
/// <inheritdoc />
@@ -31,8 +30,7 @@ namespace SharpbinV3.Server.Migrations
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "TEXT",
oldNullable: true
);
oldNullable: true);
}
}
}
@@ -16,7 +16,7 @@ namespace SharpbinV3.Server.Migrations
{
UserUUID = table.Column<Guid>(type: "TEXT", nullable: false),
EncryptedSecret = table.Column<byte[]>(type: "BLOB", nullable: false),
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
@@ -26,16 +26,15 @@ namespace SharpbinV3.Server.Migrations
column: x => x.UserUUID,
principalTable: "Users",
principalColumn: "UUID",
onDelete: ReferentialAction.Cascade
);
}
);
onDelete: ReferentialAction.Cascade);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "UserTotps");
migrationBuilder.DropTable(
name: "UserTotps");
}
}
}