Add schemas for database version 2.

This commit is contained in:
2018-04-12 06:43:45 +01:00
parent b4372a802f
commit 8e999c1b2f
23 changed files with 457 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MySql.Data" Version="6.10.6" />
</ItemGroup>
<ItemGroup>
<Folder Include="Schemas\Create" />
</ItemGroup>
</Project>

View File

@@ -1,6 +1,6 @@
using MySql.Data.MySqlClient;
namespace cicm_web.Database
namespace Cicm.Database
{
public class Mysql
{

View File

@@ -0,0 +1,9 @@
namespace Cicm.Database.Schemas
{
public class Admin
{
public int id;
public string password;
public string user;
}
}

View File

@@ -0,0 +1,23 @@
namespace Cicm.Database.Schemas
{
public class BrowserTest
{
public ushort id;
public string idstring;
public string browser;
public string version;
public string os;
public string platform;
public bool gif87;
public bool gif89;
public bool jpeg;
public bool png;
public bool pngt;
public bool agif;
public bool table;
public bool colors;
public bool js;
public bool frames;
public bool flash;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class Company
{
public int id;
public string Compania;
}
}

View File

@@ -0,0 +1,33 @@
namespace Cicm.Database.Schemas
{
public class Computer
{
public int id;
public int company;
public int year;
public string model;
public int cpu1;
public float mhz1;
public int cpu2;
public float mhz2;
public int bits;
public int ram;
public int rom;
public int gpu;
public int vram;
public int colors;
public string res;
public int spu;
public int mpu;
public int sound_channels;
public int music_channels;
public int hdd1;
public int hdd2;
public int hdd3;
public int disk1;
public string cap1;
public int disk2;
public string cap2;
public string comment;
}
}

View File

@@ -0,0 +1,29 @@
namespace Cicm.Database.Schemas
{
public class Console
{
public int id;
public int company;
public string name;
public int year;
public int cpu1;
public float mhz1;
public int cpu2;
public float mhz2;
public int bits;
public int ram;
public int rom;
public int gpu;
public int vram;
public string res;
public int colors;
public int palette;
public int spu;
public int schannels;
public int mpu;
public int mchannels;
public int format;
public int cap;
public string comments;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class ConsoleCompany
{
public int id;
public string company;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class Cpu
{
public int id;
public string cpu;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class DiskFormats
{
public int id;
public string Format;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class Dsp
{
public int id;
public string DSP;
}
}

View File

@@ -0,0 +1,11 @@
namespace Cicm.Database.Schemas
{
public class Forbidden
{
public int id;
public string browser;
public string date;
public string ip;
public string referer;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class Gpu
{
public int id;
public string gpu;
}
}

View File

@@ -0,0 +1,11 @@
namespace Cicm.Database.Schemas
{
public class Log
{
public int id;
public string browser;
public string ip;
public string date;
public string referer;
}
}

View File

@@ -0,0 +1,9 @@
namespace Cicm.Database.Schemas
{
public class MoneyDonation
{
public int id;
public string donator;
public float quantity;
}
}

View File

@@ -0,0 +1,8 @@
namespace Cicm.Database.Schemas
{
public class Mpu
{
public int id;
public string mpu;
}
}

View File

@@ -0,0 +1,10 @@
namespace Cicm.Database.Schemas
{
public class News
{
public int id;
public string date;
public int type;
public int added_id;
}
}

View File

@@ -0,0 +1,24 @@
namespace Cicm.Database.Schemas
{
public class OwnComputer
{
public int id;
public int db_id;
public string date;
public int status;
public bool trade;
public bool boxed;
public bool manuals;
public int cpu1;
public float mhz1;
public int cpu2;
public float mhz2;
public int ram;
public int vram;
public string rigid;
public int disk1;
public int cap1;
public int disk2;
public int cap2;
}
}

View File

@@ -0,0 +1,13 @@
namespace Cicm.Database.Schemas
{
public class OwnConsole
{
public int id;
public int db_id;
public string date;
public int status;
public bool trade;
public bool boxed;
public bool manuals;
}
}

View File

@@ -0,0 +1,205 @@
namespace Cicm.Database.Schemas.Sql
{
public static class V2
{
static readonly string Admins = @"CREATE TABLE IF NOT EXISTS `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` char(50) NOT NULL DEFAULT '',
`password` char(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string BrowserTests = @"CREATE TABLE IF NOT EXISTS `browser_test` (
`id` smallint(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
`idstring` varchar(128) NOT NULL DEFAULT '',
`browser` varchar(64) NOT NULL DEFAULT '',
`version` varchar(16) NOT NULL DEFAULT '',
`os` varchar(32) NOT NULL DEFAULT '',
`platform` varchar(8) NOT NULL DEFAULT '',
`gif87` tinyint(1) NOT NULL DEFAULT '0',
`gif89` tinyint(1) NOT NULL DEFAULT '0',
`jpeg` tinyint(1) NOT NULL DEFAULT '0',
`png` tinyint(1) NOT NULL DEFAULT '0',
`pngt` tinyint(1) NOT NULL DEFAULT '0',
`agif` tinyint(1) NOT NULL DEFAULT '0',
`table` tinyint(1) NOT NULL DEFAULT '0',
`colors` tinyint(1) NOT NULL DEFAULT '0',
`js` tinyint(1) NOT NULL DEFAULT '0',
`frames` tinyint(1) NOT NULL DEFAULT '0',
`flash` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);";
static readonly string Companies = @"CREATE TABLE IF NOT EXISTS `Companias` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Compania` char(128) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string Computers = @"CREATE TABLE IF NOT EXISTS `computers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`company` int(11) NOT NULL DEFAULT '0',
`year` int(11) NOT NULL DEFAULT '0',
`model` char(50) NOT NULL DEFAULT '',
`cpu1` int(11) NOT NULL DEFAULT '0',
`mhz1` decimal(11,2) NOT NULL DEFAULT '0.00',
`cpu2` int(11) DEFAULT NULL,
`mhz2` decimal(11,2) DEFAULT NULL,
`bits` int(11) NOT NULL DEFAULT '0',
`ram` int(11) NOT NULL DEFAULT '0',
`rom` int(11) NOT NULL DEFAULT '0',
`gpu` int(11) NOT NULL DEFAULT '0',
`vram` int(11) NOT NULL DEFAULT '0',
`colors` int(11) NOT NULL DEFAULT '0',
`res` char(10) NOT NULL DEFAULT '',
`spu` int(11) NOT NULL DEFAULT '0',
`mpu` int(11) NOT NULL DEFAULT '0',
`sound_channels` int(11) NOT NULL DEFAULT '0',
`music_channels` int(11) NOT NULL DEFAULT '0',
`hdd1` int(11) NOT NULL DEFAULT '0',
`hdd2` int(11) DEFAULT NULL,
`hdd3` int(11) DEFAULT NULL,
`disk1` int(11) NOT NULL DEFAULT '0',
`cap1` char(25) NOT NULL DEFAULT '0',
`disk2` int(11) DEFAULT NULL,
`cap2` char(25) DEFAULT NULL,
`comment` char(255) DEFAULT NULL,
PRIMARY KEY (`id`)
);";
static readonly string Consoles = @"CREATE TABLE IF NOT EXISTS `consoles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`company` int(11) NOT NULL DEFAULT '0',
`name` char(50) NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT '0',
`cpu1` int(11) NOT NULL DEFAULT '0',
`mhz1` decimal(11,2) NOT NULL DEFAULT '0.00',
`cpu2` int(11) DEFAULT NULL,
`mhz2` decimal(11,2) DEFAULT NULL,
`bits` int(11) NOT NULL DEFAULT '0',
`ram` int(11) NOT NULL DEFAULT '0',
`rom` int(11) NOT NULL DEFAULT '0',
`gpu` int(11) NOT NULL DEFAULT '0',
`vram` int(11) NOT NULL DEFAULT '0',
`res` char(11) NOT NULL DEFAULT '',
`colors` int(11) NOT NULL DEFAULT '0',
`palette` int(11) NOT NULL DEFAULT '0',
`spu` int(11) NOT NULL DEFAULT '0',
`schannels` int(11) NOT NULL DEFAULT '0',
`mpu` int(11) NOT NULL DEFAULT '0',
`mchannels` int(11) NOT NULL DEFAULT '0',
`format` int(11) NOT NULL DEFAULT '0',
`cap` int(11) NOT NULL DEFAULT '0',
`comments` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string ConsoleCompanies = @"CREATE TABLE IF NOT EXISTS `console_company` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`company` char(128) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string Cpus = @"CREATE TABLE IF NOT EXISTS `cpu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cpu` char(50) NOT NULL DEFAULT '',
KEY `id` (`id`)
);";
static readonly string Dsps = @"CREATE TABLE IF NOT EXISTS `DSPs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`DSP` char(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string Forbidden = @"CREATE TABLE IF NOT EXISTS `forbidden` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`browser` char(128) NOT NULL DEFAULT '',
`date` char(20) NOT NULL DEFAULT '',
`ip` char(16) NOT NULL DEFAULT '',
`referer` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string DiskFormats = @"CREATE TABLE IF NOT EXISTS `Formatos_de_disco` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Format` char(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string Gpus = @"CREATE TABLE IF NOT EXISTS `gpus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gpu` char(128) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string Logs = @"CREATE TABLE IF NOT EXISTS `log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`browser` char(128) NOT NULL DEFAULT '',
`ip` char(16) NOT NULL DEFAULT '',
`date` char(20) NOT NULL DEFAULT '',
`referer` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string MoneyDonations = @"CREATE TABLE IF NOT EXISTS `money_donation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`donator` char(128) NOT NULL DEFAULT '',
`quantity` decimal(11,2) NOT NULL DEFAULT '0.00',
PRIMARY KEY (`id`)
);";
static readonly string Mpus = @"CREATE TABLE IF NOT EXISTS `mpus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mpu` char(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
static readonly string News = @"CREATE TABLE IF NOT EXISTS `news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` char(20) NOT NULL DEFAULT '',
`type` int(11) NOT NULL DEFAULT '0',
`added_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);";
static readonly string OwnComputers = @"CREATE TABLE IF NOT EXISTS `own_computer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`db_id` int(11) NOT NULL DEFAULT '0',
`date` varchar(20) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '0',
`trade` int(11) NOT NULL DEFAULT '0',
`boxed` int(11) NOT NULL DEFAULT '0',
`manuals` int(11) NOT NULL DEFAULT '0',
`cpu1` int(11) NOT NULL DEFAULT '0',
`mhz1` decimal(10,0) NOT NULL DEFAULT '0',
`cpu2` int(11) NOT NULL DEFAULT '0',
`mhz2` decimal(10,0) NOT NULL DEFAULT '0',
`ram` int(11) NOT NULL DEFAULT '0',
`vram` int(11) NOT NULL DEFAULT '0',
`rigid` varchar(64) NOT NULL DEFAULT '',
`disk1` int(11) NOT NULL DEFAULT '0',
`cap1` int(11) NOT NULL DEFAULT '0',
`disk2` int(11) NOT NULL DEFAULT '0',
`cap2` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);";
static readonly string OwnConsoles = @"CREATE TABLE IF NOT EXISTS `own_consoles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`db_id` int(11) NOT NULL DEFAULT '0',
`date` char(20) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '0',
`trade` int(11) NOT NULL DEFAULT '0',
`boxed` int(11) NOT NULL DEFAULT '0',
`manuals` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);";
static readonly string ProcesadoresPrincipales = @"CREATE TABLE IF NOT EXISTS `procesadores_principales` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`CPU` char(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);";
}
}

View File

@@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cicm_web", "cicm_web\cicm_web.csproj", "{EB95B2DA-41CF-456F-B5E6-33B353F84258}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cicm.Database", "Cicm.Database\Cicm.Database.csproj", "{F914D5B9-0C7F-4A40-B187-269B83497AF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -12,5 +14,9 @@ Global
{EB95B2DA-41CF-456F-B5E6-33B353F84258}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB95B2DA-41CF-456F-B5E6-33B353F84258}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB95B2DA-41CF-456F-B5E6-33B353F84258}.Release|Any CPU.Build.0 = Release|Any CPU
{F914D5B9-0C7F-4A40-B187-269B83497AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F914D5B9-0C7F-4A40-B187-269B83497AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F914D5B9-0C7F-4A40-B187-269B83497AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F914D5B9-0C7F-4A40-B187-269B83497AF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -29,7 +29,6 @@
*******************************************************************************/
using System;
using cicm_web.Database;
using DiscImageChef.Interop;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
@@ -39,7 +38,7 @@ namespace cicm_web
{
public static class Program
{
static cicm_web.Database.Mysql database;
static Cicm.Database.Mysql database;
public static void Main(string[] args)
{
@@ -107,7 +106,7 @@ namespace cicm_web
DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion());
Console.WriteLine("\u001b[31;1mConnecting to MySQL database...\u001b[0m");
database = new Mysql("localhost", "cicm", "cicm", 3306, "cicmpass");
database = new Cicm.Database.Mysql("localhost", "cicm", "cicm", 3306, "cicmpass");
Console.WriteLine("\u001b[31;1mStarting web server...\u001b[0m");
BuildWebHost(args).Run();

View File

@@ -24,6 +24,10 @@
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="Database" />
<Folder Include="wwwroot\lib" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cicm.Database\Cicm.Database.csproj" />
</ItemGroup>
</Project>