public void CreateTable_Test() { if (!_sut.TableExists(_testTable)) { var query = _sut.Create(_testTable).Column("col1", "integer", false); query.Execute(); var result = _sut.TableExists(_testTable); Assert.IsTrue(result); } }
public Storage(string host, string database, string user, string password) { SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(); csb.DataSource = host; csb.InitialCatalog = database; csb.UserID = user; csb.Password = password; _db = new NovaDb(csb.ToString()); if (!_db.TableExists("Simulations")) { _db.Create("Simulations") .Column("Id", "INT IDENTITY(1,1)") .Column("Type", "varchar(250)") .Column("StartTime", "DATETIME default CURRENT_TIMESTAMP") .Column("EndTime", "DATETIME") .Column("PopulationSize", "INT") .Column("Duration", "INT") .Column("MutationRate", "INT") .Column("CrossoverRate", "INT") .Column("Complexity", "INT") .Column("SelectionPressure", "INT") .Column("Generations", "INT") .Column("Score", "INT") .Column("Chromosome", "text") .Execute(); } if (!_db.TableExists("Generations")) { _db.Create("Generations") .Column("Id", "INT IDENTITY(1,1)") .Column("StartTime", "DATETIME default CURRENT_TIMESTAMP") .Column("Generation", "INT") .Column("Simulation", "INT") .Column("FittestScore", "INT") .Column("FittestChromosome", "text") .Execute(); } }