예제 #1
0
        public void CreateInboxTable()
        {
            using (var connection = new MySqlConnection(_mysqlSettings.TestsBrighterConnectionString))
            {
                _tableName = $"`command_{_tableName}`";
                var createTableSql = MySqlInboxBuilder.GetDDL(_tableName);

                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = createTableSql;
                    command.ExecuteNonQuery();
                }
            }
        }
예제 #2
0
        private static void CreateInboxProduction(string connectionString)
        {
            using var sqlConnection = new MySqlConnection(connectionString);
            sqlConnection.Open();

            using var existsQuery   = sqlConnection.CreateCommand();
            existsQuery.CommandText = MySqlInboxBuilder.GetExistsQuery(INBOX_TABLE_NAME);
            bool exists = existsQuery.ExecuteScalar() != null;

            if (exists)
            {
                return;
            }

            using var command   = sqlConnection.CreateCommand();
            command.CommandText = MySqlInboxBuilder.GetDDL(INBOX_TABLE_NAME);
            command.ExecuteScalar();
        }
예제 #3
0
 private static void CreateMessageTable(string dbConnectionString, string tableNameMessages)
 {
     try
     {
         using (var sqlConnection = new MySqlConnection(dbConnectionString))
         {
             sqlConnection.Open();
             using (var command = sqlConnection.CreateCommand())
             {
                 command.CommandText = MySqlInboxBuilder.GetDDL(tableNameMessages);
                 command.ExecuteScalar();
             }
         }
     }
     catch (System.Exception e)
     {
         Log.Error($"Issue with creating MessageStore table, {e.Message}");
     }
 }