public async Task DropTable(string tableName)
 {
     if (await _db.TableExists(tableName))
     {
         await _db.DropTable(tableName);
     }
 }
Пример #2
0
        public static bool CastRawValuesToClassTypeProperties(IClickHouseDatabase db)
        {
            if (db.TableExists("Test"))
            {
                db.DropTable("Test");
            }

            db.CreateTable(new Table
            {
                Engine  = "MergeTree(date, (date, Id, Number, Cost), 8192)",
                Name    = "Test",
                Columns = new List <Column>()
                {
                    new Column("date", "Date"),
                    new Column("Id", "String"),
                    new Column("Number", "Int32"),
                    new Column("Cost", "Float64"),
                    new Column("Name", "String"),
                    new Column("Ushort", "UInt16"),
                    new Column("Uint", "UInt32"),
                }
            });

            var testItem = new TestDataItem3
            {
                Id     = Guid.NewGuid(),
                Number = -96,
                Cost   = 31,
                Name   = "Jon Skeet",
                Ushort = 150,
                Uint   = 65536
            };

            var command = testItem.GetInsertCommand();

            db.ExecuteNonQuery(command);

            command = "SELECT Id, Number, Cost, Name, Ushort, Uint FROM Test";
            var resultItem = db.ExecuteQueryMapping <TestDataItem3>(command, convention: new UnderscoreNamingConvention()).Single();

            db.DropTable("Test");
            return(testItem.Equals(resultItem));
        }
 private bool MigrationTableExists()
 {
     return(_dbProvider.TableExists(MigrationsTableName));
 }