DbGovor init

This commit is contained in:
Artemy
2025-06-16 22:31:45 +07:00
parent c7c778ceb1
commit d62c38db51
25 changed files with 613 additions and 36 deletions
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Govor.Data.Migrations
{
/// <inheritdoc />
public partial class initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ChatGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
InviteCode = table.Column<List<string>>(type: "text[]", nullable: false),
IsChannel = table.Column<bool>(type: "boolean", nullable: false),
IsPrivate = table.Column<bool>(type: "boolean", nullable: false),
Admins = table.Column<List<Guid>>(type: "uuid[]", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "GroupAdmins",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
GroupId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GroupAdmins", x => x.Id);
});
migrationBuilder.CreateTable(
name: "GroupMemberships",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
GroupId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
IsBanned = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GroupMemberships", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Username = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
HashPassword = table.Column<string>(type: "text", nullable: false),
IconId = table.Column<Guid>(type: "uuid", nullable: false),
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
WasOnline = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChatGroups");
migrationBuilder.DropTable(
name: "GroupAdmins");
migrationBuilder.DropTable(
name: "GroupMemberships");
migrationBuilder.DropTable(
name: "Users");
}
}
}