i forget what i did today

ok
This commit is contained in:
Malloc of Kuzkycyziklistan 2017-08-25 16:03:33 -05:00
parent 69124ad82f
commit 97a5626fd9
12 changed files with 133 additions and 83 deletions

View file

@ -1,13 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SockScape.DAL {
class Item {
public ulong Id { get; set; }
public long Id { get; set; }
[ForeignKey("Master"), Required]
public int MasterId { get; set; }
public virtual ItemMaster Master { get; set; }
[ForeignKey("User"), Required]
public long UserId { get; set; }
public virtual User User { get; set; }
[Required]
public long Quantity { get; set; }
[Required]
public long Sequence { get; set; }
}
}

View file

@ -19,16 +19,16 @@ namespace SockScape.DAL {
[Required, DefaultValue(false)]
public bool Stackable { get; set; }
[Required, DefaultValue(UInt32.MaxValue)]
public uint MaxStack { get; set; }
public long MaxStack { get; set; }
[Required, DefaultValue(true)]
public bool Droppable { get; set; }
[Required, MaxLength(64)]
public string Sheet { get; set; }
[Required]
public ushort Row { get; set; }
public int Row { get; set; }
[Required]
public ushort Column { get; set; }
public int Column { get; set; }
[MaxLength(64)]
public string Object { get; set; }

View file

@ -16,8 +16,7 @@ namespace SockScape.DAL {
public long UserId { get; set; }
public virtual User User { get; set; }
[Index("IX_RawIp_UserId_Unique", 2, IsUnique = true)]
[MaxLength(16), Required]
[Required, Index("IX_RawIp_UserId_Unique", 2, IsUnique = true)]
public byte[] RawIp { get; set; }
[NotMapped]

View file

@ -37,6 +37,8 @@ namespace SockScape.DAL {
protected override void OnModelCreating(DbModelBuilder builder) {
base.OnModelCreating(builder);
builder.HasDefaultSchema(String.Empty);
builder.Properties<string>()
.Configure(s => s.HasMaxLength(256).HasColumnType("varchar"));

View file

@ -14,9 +14,7 @@ namespace SockScape.DAL {
[Required]
public virtual User User { get; set; }
[Required]
[Index(IsUnique = true)]
[MaxLength(16), MinLength(16)]
[Required, Index(IsUnique = true)]
public byte[] Secret { get; set; }
[Required]

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,12 +10,10 @@ namespace SockScape.DAL {
public partial class User {
public long Id { get; set; }
[Required]
[MaxLength(16)]
[Required, MaxLength(16)]
public string Username { get; set; }
[Required]
[MaxLength(36), MinLength(36)]
public byte[] Password { get; set; }
[Required]

View file

@ -15,7 +15,6 @@ using MySql.Data.Entity;
namespace SockScape {
class Entrypoint {
static void Main(string[] args) {
DbConfiguration.SetConfiguration(new MySqlEFConfiguration());
var db = new DAL.ScapeDb();
Dictionary<int, Server> servers

View file

@ -1,61 +0,0 @@
namespace SockScape.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Initial : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Origins",
c => new
{
Id = c.Long(nullable: false, identity: true),
UserId = c.Long(nullable: false),
RawIp = c.Binary(nullable: false, storeType: "binary(16)"),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Users", t => t.UserId, cascadeDelete: true)
.Index(t => new { t.UserId, t.RawIp }, unique: true, name: "IX_RawIp_UserId_Unique");
CreateTable(
"dbo.Users",
c => new
{
Id = c.Long(nullable: false, identity: true),
Username = c.String(nullable: false, maxLength: 16, storeType: "varchar"),
Password = c.Binary(nullable: false, storeType: "binary(36)"),
Joined = c.DateTime(nullable: false, precision: 0),
LastLogin = c.DateTime(precision: 0),
})
.PrimaryKey(t => t.Id);
CreateTable(
"dbo.Sessions",
c => new
{
Id = c.Long(nullable: false),
Secret = c.Binary(nullable: false, storeType: "binary(16)"),
ServerId = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.Users", t => t.Id)
.Index(t => t.Id)
.Index(t => t.Secret, unique: true);
}
public override void Down()
{
DropForeignKey("dbo.Origins", "UserId", "dbo.Users");
DropForeignKey("dbo.Sessions", "Id", "dbo.Users");
DropIndex("dbo.Sessions", new[] { "Secret" });
DropIndex("dbo.Sessions", new[] { "Id" });
DropIndex("dbo.Origins", "IX_RawIp_UserId_Unique");
DropTable("dbo.Sessions");
DropTable("dbo.Users");
DropTable("dbo.Origins");
}
}
}

View file

@ -13,7 +13,7 @@ namespace SockScape.Migrations
string IMigrationMetadata.Id
{
get { return "201708231959530_Initial"; }
get { return "201708251600325_Initial"; }
}
string IMigrationMetadata.Source

View file

@ -0,0 +1,100 @@
namespace SockScape.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Initial : DbMigration
{
public override void Up()
{
CreateTable(
"ItemMaster",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 64, unicode: false),
Description = c.String(nullable: false, maxLength: 256, unicode: false),
Stackable = c.Boolean(nullable: false),
MaxStack = c.Long(nullable: false),
Droppable = c.Boolean(nullable: false),
Sheet = c.String(nullable: false, maxLength: 64, unicode: false),
Row = c.Int(nullable: false),
Column = c.Int(nullable: false),
Object = c.String(maxLength: 64, unicode: false),
})
.PrimaryKey(t => t.Id);
CreateTable(
"Items",
c => new
{
Id = c.Long(nullable: false, identity: true),
MasterId = c.Int(nullable: false),
UserId = c.Long(nullable: false),
Quantity = c.Long(nullable: false),
Sequence = c.Long(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("ItemMaster", t => t.MasterId, cascadeDelete: true)
.ForeignKey("Users", t => t.UserId, cascadeDelete: true)
.Index(t => t.MasterId)
.Index(t => t.UserId);
CreateTable(
"Users",
c => new
{
Id = c.Long(nullable: false, identity: true),
Username = c.String(nullable: false, maxLength: 16, unicode: false),
Password = c.Binary(nullable: false, storeType: "binary(36)"),
Joined = c.DateTime(nullable: false, precision: 0),
LastLogin = c.DateTime(precision: 0),
})
.PrimaryKey(t => t.Id);
CreateTable(
"Origins",
c => new
{
Id = c.Long(nullable: false, identity: true),
UserId = c.Long(nullable: false),
RawIp = c.Binary(nullable: false, storeType: "binary(16)"),
})
.PrimaryKey(t => t.Id)
.ForeignKey("Users", t => t.UserId, cascadeDelete: true)
.Index(t => new { t.UserId, t.RawIp }, unique: true, name: "IX_RawIp_UserId_Unique");
CreateTable(
"Sessions",
c => new
{
Id = c.Long(nullable: false),
Secret = c.Binary(nullable: false, storeType: "binary(16)"),
ServerId = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("Users", t => t.Id)
.Index(t => t.Id)
.Index(t => t.Secret, unique: true);
}
public override void Down()
{
DropForeignKey("Items", "UserId", "Users");
DropForeignKey("Sessions", "Id", "Users");
DropForeignKey("Origins", "UserId", "Users");
DropForeignKey("Items", "MasterId", "ItemMaster");
DropIndex("Sessions", new[] { "Secret" });
DropIndex("Sessions", new[] { "Id" });
DropIndex("Origins", "IX_RawIp_UserId_Unique");
DropIndex("Items", new[] { "UserId" });
DropIndex("Items", new[] { "MasterId" });
DropTable("Sessions");
DropTable("Origins");
DropTable("Users");
DropTable("Items");
DropTable("ItemMaster");
}
}
}

View file

@ -118,9 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO1a3W7bNhS+H7B3EHQ5pJaTrMVm2C1SJxncJXEQucXuAlqiHaIUqZJUGmPYk+1ij7RX2NG/REq2bCdZVgy+sSmeH57znUPyk//+86/hu4eAWvdYSMLZyD7s9W0LM4/7hC1HdqQWr36y3739/rvhmR88WJ/yecfxPJBkcmTfKRUOHEd6dzhAshcQT3DJF6rn8cBBPneO+v2fncNDB4MKG3RZ1vAmYooEOPkBP8eceThUEaKX3MdUZuPwxE20WlcowDJEHh7ZLvc+ux4Kce/05MK2TihB4ISL6cK2EGNcIQUuDj5K7CrB2dINYQDR2SrEMG+BqMSZ64NyetdV9I/iVTilYK7Ki6TiwZYKD4+zsDi6+E7BtYuwQeDOIMBqFa86Cd7IngqyJKBYNzUYUxFP0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+Pot2Bc5OxoHvsHDr/mShyFkO06L1sOKnvtjh6pE+21dFWMMMkwd8M19raXJ2bzofH6LbyNkrwehUlq4m62pANmhZq2NsMBqj8e3aH01W2/bgTgpPuDvO1U2ZUhChuQVWc+PgBI+aldbiYHzgXpCw7du7ZZI8IH4qMtGHcRMuOBls2WPD5xahhMTUTQ7oq2rRZlMk0aMs3x8f+8YpJkQPevbRRtWOExmW0tsSYgtqKquRbUUGWyd9diofaif1RqstRLDE8OG9J3bhvWqORikZLgvSKF0fLIPd6qc3PkF+VNvFLRoFd7hO7ooX1DvHFtYZdVYnhBX+oovC+PO4MFBkaNYYSXFcTpFMcGgWHFZJeXaSXH25QH1ZoBh2bSY24SYxYIZp0YltWJ6pr2yMq1PhxWw6wJzJEmRFNFrlfdagRK+6P1HD4oFr0U/Jhe6AmHD6gqaQboBnsJqxYMJb+jSS2CRC0biD4v5iEYaCE4fqbC/yQiN2gZZH4pP0qCykIWYw+ySh6AAFl1QFfOf432X8FUc4+eR+vYHiBb3Ka5pQNGcarSJGe8F1lU/+FMFK1eXFTJFHIawyBmYn4U9cNfpejKKztPtdciQ0QfLuq3pL4WlL+prR+qZGuE2wJVE1fvcvewziNGBi5wT54gmNsY2S9hGsQvIi0oxmkfyHUaV+cIbDOQEwqjKY9+5VxOIyff/4/EUA/gipMAAA=</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
<value />
</data>
</root>

View file

@ -96,9 +96,9 @@
<Compile Include="DAL\User.cs" />
<Compile Include="Encryption\KeyExchange.cs" />
<Compile Include="Encryption\Cipher.cs" />
<Compile Include="Migrations\201708231959530_Initial.cs" />
<Compile Include="Migrations\201708231959530_Initial.Designer.cs">
<DependentUpon>201708231959530_Initial.cs</DependentUpon>
<Compile Include="Migrations\201708251600325_Initial.cs" />
<Compile Include="Migrations\201708251600325_Initial.Designer.cs">
<DependentUpon>201708251600325_Initial.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="ServerList.cs" />
@ -163,8 +163,8 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201708231959530_Initial.resx">
<DependentUpon>201708231959530_Initial.cs</DependentUpon>
<EmbeddedResource Include="Migrations\201708251600325_Initial.resx">
<DependentUpon>201708251600325_Initial.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />